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

Observable.from should throw primitive iterables (strings) #125

Open
benlesh opened this issue Mar 5, 2024 · 1 comment
Open

Observable.from should throw primitive iterables (strings) #125

benlesh opened this issue Mar 5, 2024 · 1 comment

Comments

@benlesh
Copy link
Collaborator

benlesh commented Mar 5, 2024

Along with how Iterator helpers behave, if a user passes a string, even though it's an iterable, it's likely an error. We should throw a TypeError in that case.

Observable.from('some string'); // TypeError
@bakkot
Copy link
Contributor

bakkot commented Mar 5, 2024

I think you misread my comment (which was not all that clear, sorry). Iterator.from does not throw when given a string. This makes it different from flatMap, which does throw when the mapper returns a string, even though strings are iterable.

See discussion in tc39/proposal-iterator-helpers#244.

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

2 participants