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

Inlined const enums add comments that aren't escaped #2369

Closed
pushkine opened this issue Jul 3, 2022 · 1 comment · Fixed by #2371
Closed

Inlined const enums add comments that aren't escaped #2369

pushkine opened this issue Jul 3, 2022 · 1 comment · Fixed by #2371

Comments

@pushkine
Copy link

pushkine commented Jul 3, 2022

🕗 Version

latest 0.14.48

💻 Code

// bar.ts
export const enum PRCD {
	"*/%" = 14,
}

// foo.ts
import { PRCD } from "./bar";

console.log(PRCD["*/%"]);
esbuild foo.ts --bundle --outfile=foo.js

🙁 Actual behavior

"use strict";
(() => {
  // foo.ts
  console.log(14 /* */% */);
})();
  console.log(14 /* */% */);
//                      ^^ ERROR: Unterminated regular expression literal. ts(1161)

🙂 Expected behavior

No errors

@hyrious
Copy link

hyrious commented Jul 3, 2022

Interesting, I haven't seen this behavior in transform mode because it removes comments. TypeScript used to have this issue too but they have fixed it in 4.7 with a simple string-replacement: */*_/. (see more about that at microsoft/TypeScript#47990)

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

Successfully merging a pull request may close this issue.

2 participants