inspect-js / which-typed-array

Which kind of Typed Array is this JavaScript value? Works cross-realm, without `instanceof`, and despite Symbol.toStringTag.
MIT License
11 stars 4 forks source link

Seeing issue with IE11 potentially related #51

Closed nspector closed 3 years ago

nspector commented 3 years ago

Hi! On our apps on IE11 we're seeing the error: this engine has support for Symbol.toStringTag, but Float32Array does not have the property! Please report this. I believe it is from the changes that were made yesterday. If not, I'm sorry for the inconvenience. My theory is that the change from

var hasToStringTag = hasSymbols && typeof Symbol.toStringTag === 'symbol';

to

var hasToStringTag = require('has-tostringtag/shams')();

is not the same check. has-tostringtag/shams does:

    return hasSymbols() && !!Symbol.toStringTag;

On IE11 for us, our typeof Symbol.toStringTag is object, so it is now truthy, where-as previously it was not.

Thanks! Let me know if you want me to help with any further diagnostics!


Edit: Confirmed that I was able to fix IE11 by pinning: is-typed-array and which-typed-array (I might only need the former, was a little whack-a-mole, and added it after just the latter didn't fix it). We're getting these as a dependency of util:

"util": "^0.12.4"
ljharb commented 3 years ago

Thanks for filing!

Presumably you're using core-js? Which version?

Can you check what new Float32Array(0)[Symbol.toStringTag] returns in your shimmed IE 11 environment?

nspector commented 3 years ago

Presumably you're using core-js? Which version?

based on our babel config, looks like 3.

Can you check what new Float32Array(0)[Symbol.toStringTag] returns in your shimmed IE 11 environment?

undefined

ljharb commented 3 years ago

just 3? what does node_modules/core-js/package.json say?

nspector commented 3 years ago

Sorry, meant using this cofig: https://babeljs.io/docs/en/babel-plugin-transform-runtime#corejs -- the package.json shows version: 3.16.0

ljharb commented 3 years ago

gotcha, thanks. i'll fix the error here to account for typed arrays with shammed symbols :-)

nspector commented 3 years ago

Thank you!

ljharb commented 3 years ago

Released in v1.1.6; please let me know if that works for you :-)

nspector commented 3 years ago

@ljharb coming from here now: https://github.com/inspect-js/is-typed-array/blob/main/index.js#L28

ljharb commented 3 years ago

aha, thanks :-) fixing that next.

ljharb commented 3 years ago

Fixed in is-typed-array v1.1.7.

nspector commented 3 years ago

looks like that fixed it!