-
Notifications
You must be signed in to change notification settings - Fork 16
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
Comments
I think you misread my comment (which was not all that clear, sorry). See discussion in tc39/proposal-iterator-helpers#244. |
FYI: |
If someone is intentionally passing a string into an |
Can a usecase be returning a string from the catch operator? |
I'm sold on ensuring |
I think the behavior of
|
If you do so, please specify in the specification that primitive |
@petamoriken The normative-conventions wording shouldn't apply to explicit coercion methods like |
Well, I don't understand why |
If I understand correctly the current plan is for |
It does not seem so. |
@bakkot No, the plan is to accept boxed strings, but not primitive strings |
Ah. Well, that's unfortunate. In that case I have no opinion about what |
The entire point of a "from" method is to explicitly convert from one type to another. It's the one place rejecting strings makes no sense (or rephrased, the one place accepting iterable strings makes sense), and if Readable.from wants to be the weird one, that doesn't mean Observable.from should join it. |
Actually what I said may be wrong. I have to read thru the discussion again. Specifically the |
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: