You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to replace some emojis with images so I am using emoji-regex to find them and get the true length of the emoji so that it can be substituted, they recommend using ...
[...emoji].length
... that under certain tsconfig.json options, will be transpiled to ...
__spreadArray([],emoji,true).length
I have tried other variations, including Array.from() and emoji.length, and only the variation above yields accurate lengths. Fortunately, swallowing the error in a try-catch seems to work so it seems the error is not critical for spreadArray to function for some reason and I do not know why.
The text was updated successfully, but these errors were encountered:
jcfranco
added a commit
to jcfranco/tslib
that referenced
this issue
May 17, 2022
Expected behavior
No error occurs when
spreadArray
is used on a string containing an emoji/Unicode character.Current behavior
When
spreadArray
is used on a string containing an emoji/Unicode character, the following error occurs:I believe the problem is related to https://github.com/microsoft/tslib/blob/2.3.1/tslib.js#L208 because if you run ...
... the same error occurs.
Steps to reproduce
https://codesandbox.io/s/beautiful-cohen-86fygb?file=/src/index.js:220-251
Context
I need to replace some emojis with images so I am using emoji-regex to find them and get the true length of the emoji so that it can be substituted, they recommend using ...
... that under certain
tsconfig.json
options, will be transpiled to ...I have tried other variations, including
Array.from()
andemoji.length
, and only the variation above yields accurate lengths. Fortunately, swallowing the error in atry-catch
seems to work so it seems the error is not critical forspreadArray
to function for some reason and I do not know why.The text was updated successfully, but these errors were encountered: