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
Add aliases for Standardized, TypeScript, and Flow #13666
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/48190/ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 9da61e2:
|
We have docs on the website for aliases, but I don't remember if they are auto-generated. |
Re: babel/babel#13666 Seems these docs were a bit out of date. We should probably automate this, I generated it by running ```bash $ cd babel $ node packages/babel-types/scripts/generators/docs.js > ../babel-website/docs/types.md ```
Opened babel/website#2564 to update the docs. |
@@ -217,6 +217,8 @@ const aliasDescriptions = { | |||
"A cover of [Literal](https://tc39.es/ecma262/#sec-primary-expression-literals)s, [Regular Expression Literal](https://tc39.es/ecma262/#sec-primary-expression-regular-expression-literals)s and [Template Literal](https://tc39.es/ecma262/#sec-template-literals)s.", | |||
Loop: "A cover of loop statements.", | |||
Method: "A cover of object methods and class methods.", | |||
Miscellaneous: | |||
"A cover of non-standard AST types that are sometimes useful for development.", |
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.
If we want to support type Core = Exclude<t.Node, t.TypeScript | t.Flow>;
, why don't we add a Core
alias? The Miscellaneous
type is a bit vague: you don't know what is until you have checked its containing types.
We have core.ts
for the spec and experimental.ts
for proposals, since core
types won't become experimental, we can add Core
for core.ts
and CoreAndProposals
for core.ts
and experimental.ts
.
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.
Good idea. I chose Standardized
, Proposal
, and StandardizedOrProposal
for the aliases.
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.
We cannot have the Proposal
alias, otherwise when a proposal becomes stable we'll need a breaking change to remove it from there.
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.
I agree with @nicolo-ribaudo. I think we can start with only Standardized
and TypeScript
, and add more in the future.
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.
We cannot have the Proposal alias, otherwise when a proposal becomes stable we'll need a breaking change to remove it from there.
That makes sense, I'll remove.
I think we can start with only Standardized and TypeScript, and add more in the future.
I'm gonna keep Flow
, but agreed.
This helps with filter out the types. Eg, I'm concerned with just the core JS types, and in I can derive them via: ```typescript type Core = Exclude<t.Node, t.TypeScript | t.Flow>; ```
33a4b35
to
84105a4
Compare
84105a4
to
a818759
Compare
e34cf48
to
9da61e2
Compare
This helps with filter out the types. Eg, I'm concerned with just the core JS types, and in I can derive them via: