Skip to content

Syntax Error for let var declaration under semicolon-less instantiation expressions #49348

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

Closed
sosukesuzuki opened this issue Jun 2, 2022 · 1 comment Β· Fixed by #49353
Closed
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@sosukesuzuki
Copy link

Bug Report

πŸ”Ž Search Terms

  • instantiation expression semicolon

πŸ•— Version & Regression Information

  • This is a bug of new syntax that is landed in TS 4.7

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

const foo = func<string>

let bar;

πŸ™ Actual behavior

Syntax error Cannot find name 'let'.(2304)

πŸ™‚ Expected behavior

Parsing successfully

@ahejlsberg ahejlsberg self-assigned this Jun 2, 2022
@ahejlsberg ahejlsberg added the Bug A bug in TypeScript label Jun 2, 2022
@ahejlsberg
Copy link
Member

ahejlsberg commented Jun 2, 2022

Hmm, yeah, it seems were not doing the right thing when an instantiation expression is immediately followed by a strict mode reserved word (which includes interface and let). In non-strict mode interface and let are valid identifiers, but when they follow a type argument list and are immediately preceded by a line break, it is very unlikely that's the desired interpretation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants