Skip to content

Unexpected ASI after declare (regression since version 4.4) #54602

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

Open
evanw opened this issue Jun 10, 2023 · 1 comment
Open

Unexpected ASI after declare (regression since version 4.4) #54602

evanw opened this issue Jun 10, 2023 · 1 comment
Assignees
Labels
Bug A bug in TypeScript Rescheduled This issue was previously scheduled to an earlier milestone

Comments

@evanw
Copy link
Contributor

evanw commented Jun 10, 2023

Bug Report

πŸ”Ž Search Terms

declare asi semicolon

πŸ•— Version & Regression Information

⏯ Playground Link

Playground link for version 4.3.5 (fine)
Playground link for version 4.4.4 (problematic)

πŸ’» Code

Some random examples that TS 5.1 considers valid syntax (not exhaustive):

declare let declare: any, foo: any
declare foo
declare let declare: any, foo: any
declare foo()
declare let declare: any, foo: any
declare {foo}

πŸ™ Actual behavior

TypeScript silently does automatic semicolon insertion after declare in all of these cases without generating any syntax errors.

πŸ™‚ Expected behavior

I expected these to be syntax errors. I did not expect TypeScript to silently be doing automatic semicolon insertion after declare here as if this is valid syntax.

@jakebailey
Copy link
Member

FWIW this (and #54760) bisects to #43005.

@RyanCavanaugh RyanCavanaugh added the Rescheduled This issue was previously scheduled to an earlier milestone label Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Rescheduled This issue was previously scheduled to an earlier milestone
Projects
None yet
Development

No branches or pull requests

4 participants