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

Type specification in for #1152

Closed
edemaine opened this issue Apr 7, 2024 · 0 comments · Fixed by #1418
Closed

Type specification in for #1152

edemaine opened this issue Apr 7, 2024 · 0 comments · Fixed by #1418
Labels
typescript TypeScript compatibility or extensions

Comments

@edemaine
Copy link
Collaborator

edemaine commented Apr 7, 2024

I think we should allow specifying the type of declarations within for loops. Examples:

for x: T of y
for x: T in y
for each x: T of y
for let [x, y]: [A, B] of y

Some of these currently have a different meaning (e.g. for {x: T} of y). An alternative that would preserve this implicit object destructuring meaning would be able to allow type specifiers only when there's an explicit const/let/var:

for const x: T of y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typescript TypeScript compatibility or extensions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant