Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symbol is not a supported type in Ember.typeOf(); returns "object" #11673

Closed
notmessenger opened this issue Jul 7, 2015 · 13 comments
Closed

Comments

@notmessenger
Copy link

ember.js/packages/ember-runtime/lib/utils.js

@stefanpenner
Copy link
Member

Is that a real es6 symbol or a polyfiled one

@rwjblue
Copy link
Member

rwjblue commented Jul 7, 2015

Most likely

export function typeOf(item) {
needs similar treatment to #11239

@notmessenger
Copy link
Author

Hrm...the polyfilled one

@notmessenger
Copy link
Author

Aww man @rwjblue I looked for an issue that might have already addressed this and I missed it. Sorry about that.

@stefanpenner
Copy link
Member

Hrm...the polyfilled one

embers or some other? There are potentially many

@notmessenger
Copy link
Author

@stefanpenner Whatever the default babel configuration is with Ember CLI. I have not made any modifications and am assuming that http://babeljs.io/docs/usage/polyfill/ is in play but perhaps there is a gap in my understanding.

@stefanpenner
Copy link
Member

im not sure the polyfil decorates itself correctly

@stefanpenner
Copy link
Member

let me check

@stefanpenner
Copy link
Member

perfect, seems like it does

% node -v                                                                                                                                                                  v0.10.35
> require('core-js/shim');
> Symbol
[Function: Symbol]
> Object.prototype.toString.call(Symbol)
'[object Function]'
> Object.prototype.toString.call(Symbol('a'))
'[object Symbol]'
>

@stefanpenner
Copy link
Member

We have decided to freeze Ember.typeOf do to the broken landscape of @@toStringTag.

We can likely revisit at some future point in time, when the landscape has become reasonable.

Example insanity:

IE11:

Object.prototype.toString.call(new Map()) === '[object Object]'

Chrome: Version 45.0.2449.0 canary (64-bit)

Object.prototype.toString.call(new Map()) === '[object Map]';
Object.prototype.toString.call(new Promise(function(){}))  === '[object Promise]';

Chrome: Version 43.0.2357.130 (64-bit)

Object.prototype.toString.call(new Map()) === '[object Map]';
Object.prototype.toString.call(new Promise(function(){}))  === '[object Object]';

@stefanpenner
Copy link
Member

I would have loved to fix this, unfortunately requireing something like core-js to always 100% of time be on the page for a feature to work isn't something we can commit to. Especially for something like Ember.typeOf.

Just changing this in embers code-basse actually uncovered several issues.

I hope we will revisit in the future.

@notmessenger
Copy link
Author

If I'm understanding my research correctly for @@toStringTag we will run into the same problem you have listed by using typeof instead, correct?

@stefanpenner
Copy link
Member

same problem you have listed by using typeof instead

nope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants