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

False positive: Unexpected newline after "type" #3225

Closed
cowwoc opened this issue Jul 12, 2023 · 1 comment
Closed

False positive: Unexpected newline after "type" #3225

cowwoc opened this issue Jul 12, 2023 · 1 comment

Comments

@cowwoc
Copy link

cowwoc commented Jul 12, 2023

Testcase: https://esbuild.github.io/try/#dAAwLjE3LjYALS1wbGF0Zm9ybT1uZXV0cmFsIC0tZm9ybWF0PWVzbSAtLWxvYWRlcj10cwBpbXBvcnQgdHlwZSB0IGZyb20gInRzeCI7CgpleHBvcnQgdHlwZQp7CiAgdAp9Ow

Specifically, when compiling:

import type t from "tsx";

export type
{
  t
};

esbuild doesn't like the opening brace on the next line. If you move the brace up to the same line as "export type" the error disappears.

The testcase is legal Typescript, so I believe esbuild's behavior is a bug.

@evanw
Copy link
Owner

evanw commented Jul 12, 2023

Thanks for the report. I think this is happening because the following is supposed to be invalid:

export type
T = t

So esbuild needs to distinguish between these two cases.

@evanw evanw closed this as completed in bf165fc Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants