💻
How are you using Babel?
Other (Next.js, Gatsby, vue-cli, ...)
Input code
class C {
accessor
property
}
Configuration file name
No response
Configuration
Use @babel/parser as a Node.js API.
Current and expected behavior
current:
@babel/parser with typescript plugin parses the input code to:
// pseudo AST
{
type: class
children: [
property ( name = "accessor" ),
property ( name = "foo" )
]
}
But TypeScript Compiler parses the input code to:
// pseudo AST
{
type: class
children: [
accessor property ( name = "foo" )
]
}
expected:
Must match the decorator spec. I don't know which is correct.
If TypeScript Compiler behavior is wrong, we should report to microsoft/typescript repository.
Environment
Environment does not matter.
Possible solution
Fix parsing logic
Additional context
I noticed this while working on printing accessor property syntax for Prettier ( prettier/prettier#13919 )
💻
How are you using Babel?
Other (Next.js, Gatsby, vue-cli, ...)
Input code
Configuration file name
No response
Configuration
Use
@babel/parseras a Node.js API.Current and expected behavior
current:
@babel/parserwithtypescriptplugin parses the input code to:But TypeScript Compiler parses the input code to:
expected:
Must match the decorator spec. I don't know which is correct.
If TypeScript Compiler behavior is wrong, we should report to microsoft/typescript repository.
Environment
Environment does not matter.
Possible solution
Fix parsing logic
Additional context
I noticed this while working on printing accessor property syntax for Prettier ( prettier/prettier#13919 )