fix: Keep type annotations in syntacticPlaceholders mode#16905
fix: Keep type annotations in syntacticPlaceholders mode#16905nicolo-ribaudo merged 2 commits intobabel:mainfrom
syntacticPlaceholders mode#16905Conversation
liuxingbaoyu
commented
Oct 14, 2024
| Q | A |
|---|---|
| Fixed Issues? | Fixes #16904 |
| Patch: Bug Fix? | √ |
| Major: Breaking Change? | |
| Minor: New Feature? | |
| Tests Added + Pass? | Yes |
| Documentation PR Link | |
| Any Dependency Changes? | |
| License | MIT |
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/58137 |
| } | ||
|
|
||
| if (hasOwn(node, "typeAnnotation")) { | ||
| newNode.typeAnnotation = deep |
There was a problem hiding this comment.
Can we declare these various extra properties in the type definitions of Placehodler?
There was a problem hiding this comment.
export const PLACEHOLDERS = [
"Identifier",
"StringLiteral",
"Expression",
"Statement",
"Declaration",
"BlockStatement",
"ClassBody",
"Pattern",
] as const;
I'm afraid there are other properties that should be here, which would result in a large number of properties in the Placehodler type definition.
However, I haven't thought of a better way so far.
There was a problem hiding this comment.
Can they, though? For example, a placeholder will never have a .body because it's "inside" the node.
The identifier properties are special because they are not really inside the identifier, so they are not hidden by the placeholder.
4f835bd to
d703353
Compare
nicolo-ribaudo
left a comment
There was a problem hiding this comment.
Approving assuming that CI will be green