-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
TouchList is missing Symbol.iterator, can't use with 'for..of' #31826
Comments
This is an old issue, but is this actually an issue given we have: TypeScript/src/lib/dom.iterable.generated.d.ts Lines 308 to 310 in 405251e
This was introduced by #24669, but that PR is a full year older than this issue, so I'm not sure what's going on here such that this error ever appeared. (@fatcerberus I think you're still around, so I'm not gonna close this in case you recall what was actually going on and I'm just reproducing it wrong.) |
@jakebailey I don’t recall; it might be that I didn’t have It also seems weird that the playground required |
Ah, gotcha, yeah, one has to specify DOM.Iterable, it seems (the playground must). I guess I'm not well-versed enough to understand why that's not included by default, or if we should be hinting to users that "maybe you forgot this". @sandersn may know better than me, I'm just going over old issues looking for already fixed stuff! |
I can't even repro this locally. What's the tsconfig look like? I tried target: "es5" and lib: ["dom", "es5"]. |
I don’t think I have the project I was testing this in anymore, so I haven’t tested locally yet, but it’s still reproducible in the playground at least: |
Argh, I wrote |
Anyway, there's a fixed list of constructors (Promise, Symbol, etc) in isES2015OrLaterConstructorName and in getCannotFindNameDiagnosticForName, some other values, that trigger a specific error. I didn't see anything smarter than that. I don't know why dom.iterable is broken out from dom either. It was from before my time helping with DOM types. |
Concretely, my questions are just:
|
|
I always assumed the reason dom.iterable was split out is because it involves |
That's my guess, yeah, it's just that unlike setting say, es6 or es2017 or something, it doesn't actually get enabled automatically... |
TypeScript Version: 3.6.0-dev.20190608
Search Terms: touchlist iterator
Code
Expected behavior:
Code compiles successfully.
Actual behavior:
Error on line 2:
Type 'TouchList' must have a '[Symbol.iterator]()' method that returns an iterator. ts(2488)
Playground Link:
N/A because the Playground complains due to
for...of
requiring--downlevelIteration
--but there's no way to enable it.Related Issues:
#2695, labeled
help wanted
but closedThe text was updated successfully, but these errors were encountered: