microsoft / tslib

Runtime library for TypeScript helpers.
BSD Zero Clause License
1.25k stars 126 forks source link

fix: allow spreading of strings within arrays #177

Open jcfranco opened 2 years ago

jcfranco commented 2 years ago

Fixes #175

This restores array spreading for the following use case:

[..."foo"]; // ['f', 'o', 'o']

@rbuckton @DanielRosenwasser @weswigham First time contributing to this project, so please let me know if there's something I missed.

ghost commented 2 years ago

CLA assistant check
All CLA requirements met.

driskull commented 2 years ago

This would be nice! :)

jcfranco commented 2 years ago

friendly ping 😁

rbuckton commented 1 year ago

A simpler change might be if (ar || !(i in Object(from))) { to coerce the string to an object for use with in. We'd also need to make this change in TypeScript before we take it for tslib, however.