Skip to content

Misc fixes to @babel/types AST definitions#14730

Merged
nicolo-ribaudo merged 7 commits intobabel:mainfrom
JLHwung:ast-types-misc-fix
Jul 7, 2022
Merged

Misc fixes to @babel/types AST definitions#14730
nicolo-ribaudo merged 7 commits intobabel:mainfrom
JLHwung:ast-types-misc-fix

Conversation

@JLHwung
Copy link
Copy Markdown
Contributor

@JLHwung JLHwung commented Jul 6, 2022

Q                       A
Fixed Issues? See below
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT
  • Allow BigIntLiteral as property/method key
  • Refine error message when parsing decorator codes without the corresponding plugin: Now Babel will throw "Support for the experimental syntax 'decorators' isn't currently enabled" instead of referring to the legacy decorators plugin.
  • Validate ClassPrivateProperty.static (boolean defaults to false)
    Technically this one may be a breaking change, because now Babel types will throw when the provided static is non-boolean, though I doubt anyone has ever spotted it.
  • Disallow "constructor" as ClassPrivateMethod.kind

@JLHwung JLHwung added PR: Spec Compliance 👓 A type of pull request used for our changelog categories pkg: types labels Jul 6, 2022
@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Jul 6, 2022

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

@JLHwung
Copy link
Copy Markdown
Contributor Author

JLHwung commented Jul 6, 2022

BTW TIL we have "decorators"

decorators: {
validate: chain(
assertValueType("array"),
assertEach(assertNodeType("Decorator")),
),
},

for the PatternLike nodes such as Identifier/ArrayPattern/ObjectPattern. Does @f x has ever been supported in legacy decorators proposal? Currently Babel throws "leading decorators must be attached to a class declaration" anyway. If this property is redundant we can consider remove it from Babel 8.

@nicolo-ribaudo
Copy link
Copy Markdown
Member

@JLHwung That's probably for TS parameter decorators:

class A {
  f(@d a, @d { x, y }) {}
}

Changing it goes in the same direction as #9545.

@nicolo-ribaudo nicolo-ribaudo changed the title AST types misc fix Misc fixes to @babel/types AST definitions Jul 7, 2022
@nicolo-ribaudo nicolo-ribaudo merged commit 1c79224 into babel:main Jul 7, 2022
@nicolo-ribaudo nicolo-ribaudo deleted the ast-types-misc-fix branch July 7, 2022 10:38
@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 Oct 7, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: types PR: Spec Compliance 👓 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants