Add declarations for more of @babel/types exports#10504
Add declarations for more of @babel/types exports#10504nicolo-ribaudo merged 1 commit intobabel:masterfrom
Conversation
| ); | ||
| } | ||
|
|
||
| lines.push( |
There was a problem hiding this comment.
I think this whole thing would be much nicer to modify if there was, say, a typescript.template.d.ts file that is complete enough to be typechecked and with placeholder comments / types for where the generated types should get injected; the generator script then just needs to slurp the template and edit it.
It'd also get us prettier for free.
937a656 to
b60ec41
Compare
This adds lots of missing declarations to the types of @babel/types, including many utility functions useful to plugin authors. With the typescript types, I tried to make them as useful as possible for control flow analysis / inference, but Flow doesn't seem to support overloads and I'm not as familiar with it anyway so it has simpler types.
b60ec41 to
6e8ad67
Compare
|
CircleCI's build failed.... because it ran out of memory? o_O |
|
Yeah it's flaky |
|
|
||
| lines.push( | ||
| `export function is${typeName}(node: object | null | undefined, opts?: object | null): ${result};`, | ||
| // TypeScript 3.7: https://github.com/microsoft/TypeScript/pull/32695 will allow assert declarations |
There was a problem hiding this comment.
We can use typesVersions to publish typings for typescript <3.7 and typescript >=3.7 at the same time, but we'll need to generate types twice.
I want to refactor the typescript generation to use .d.ts files as templates (to make it much easier to get editor feedback while modifying them) so I can try to do that at the same time.
This adds lots of missing declarations to the types of @babel/types,
including many utility functions useful to plugin authors.
With the typescript types, I tried to make them as useful as possible
for control flow analysis / inference, but Flow doesn't seem to
support overloads and I'm not as familiar with it anyway so it has
simpler types.