Skip to content

for ( async of should be a syntax errorΒ #43879

Closed
@Zzzen

Description

@Zzzen

Bug Report

πŸ”Ž Search Terms

for async of syntax error

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

var async;
for (async of [42]) {}
console.log(async);

πŸ™ Actual behavior

no error reported.

πŸ™‚ Expected behavior

The compiler should throw a syntax error: Uncaught SyntaxError: The left-hand side of a for-of loop may not be 'async'.

context: tc39/ecma262#2034

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions