Open jribeiro opened 1 year ago
Yes, I'm seeing this on React Native too (though it depends on which JS engine is being used). The suggested fix above should indeed work. Another option would be to move the bytesPerElement
definition above the typeof TypedArray !== 'function'
check.
If need be, could even put BYTES_PER_ELEMENT
on the fake typed array constructors. (Per MDN, the value of that property would be 8 for each of those.)
I'd be happy to submit a PR to fix this. My only concern is how this can be tested without running on a JS engine with no big int support. 😅
I just came here to open a PR, but I see that this was fixed in a commit to master. Thanks, @kriszyp! 🎉
Hi @kriszyp! Just a friendly bump: would you mind pushing a new version to npm to get this fix out? (I had initially assumed this would be an easy patch version bump, but I see that the diff since the last release is larger than this one commit.)
Thanks for the reminder, published in v1.5.2.
Confirmed this fixed my React Native app startup (with Hermes < 0.12). I'm not the issue opener, but I'm pretty sure you can close this. 🙂
On browsers not supporting
BigUint64Array
orBigInt64Array
, cbor-x is throwing an exceptionnull is not an object (evaluating 'TypedArray.BYTES_PER_ELEMENT
. This is due to this code: https://github.com/kriszyp/cbor-x/blob/master/decode.js#L1064-L1065You can reproduce this on Safari 13 or IE 11 for instance.
I applied the following patch locally. If I understand correctly, It will still throw if those types are used which might not be ideal.