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
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
The text was updated successfully, but these errors were encountered:
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.
If someone is intentionally passing a string into an X.from method, they explicitly want to convert a string into an X. I think this is the one case where an iterable string must be accepted.
Can a usecase be returning a string from the catch operator?
How should I do this if Observable.from throws on a string? Or can I just return the string?
(having rxjs of("...") in mind)
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 aTypeError
in that case.The text was updated successfully, but these errors were encountered: