-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
fix: Keep type annotations in syntacticPlaceholders
mode
#16905
Conversation
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we declare these various extra properties in the type definitions of Placehodler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving assuming that CI will be green