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

Allow negative number in ambient const initializer #15338

Merged
merged 2 commits into from
Jan 11, 2023

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Jan 11, 2023

Q                       A
Fixed Issues? Fixes #15337
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT
  • Allow negative numbers in ambient const initializers. E.g.
declare module N {
  const negative_number = -1;
}
  • Added new tests as it seems that the error is not covered by any other tests.

The literal AST difference between Babel and ESTree is somehow annoying, an estree boolean toggle is added so we don't have to take care of the inheritance ordering between the estree plugin and the typescript plugin. (We may want to enforce plugin orderings for estree and other language extensions.)

@JLHwung JLHwung added PR: Bug Fix 🐛 A type of pull request used for our changelog categories pkg: parser area: typescript labels Jan 11, 2023
@babel-bot
Copy link
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/53762/

@JLHwung JLHwung merged commit f7e231f into babel:main Jan 11, 2023
@JLHwung JLHwung deleted the fix-15337 branch January 11, 2023 15:54
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Apr 13, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: typescript outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Babel unable to parse export declare const of a negative number literal in a .d.ts file
4 participants