refactor(napi): move custom types to bottom of file (#6930)

Pure refactor. Doesn't matter much but I think it's preferable for the file not to start with the most random weird types.
This commit is contained in:
overlookmotel 2024-10-26 17:10:33 +00:00
parent 23157bde6f
commit 992699012f
2 changed files with 36 additions and 35 deletions

View file

@ -1,39 +1,6 @@
// Auto-generated code, DO NOT EDIT DIRECTLY!
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/typescript.rs`
export interface FormalParameterRest extends Span {
type: 'RestElement';
argument: BindingPatternKind;
typeAnnotation: TSTypeAnnotation | null;
optional: boolean;
}
export type RegExpFlags = {
/** Global flag */
G: 1;
/** Ignore case flag */
I: 2;
/** Multiline flag */
M: 4;
/** DotAll flag */
S: 8;
/** Unicode flag */
U: 16;
/** Sticky flag */
Y: 32;
/** Indices flag */
D: 64;
/** Unicode sets flag */
V: 128;
};
export type JSXElementName =
| JSXIdentifier
| JSXNamespacedName
| JSXMemberExpression;
export type JSXMemberExpressionObject = JSXIdentifier | JSXMemberExpression;
export interface BooleanLiteral extends Span {
type: 'BooleanLiteral';
value: boolean;
@ -2008,3 +1975,36 @@ export interface NamedReference extends Span {
type: 'NamedReference';
name: string;
}
export interface FormalParameterRest extends Span {
type: 'RestElement';
argument: BindingPatternKind;
typeAnnotation: TSTypeAnnotation | null;
optional: boolean;
}
export type RegExpFlags = {
/** Global flag */
G: 1;
/** Ignore case flag */
I: 2;
/** Multiline flag */
M: 4;
/** DotAll flag */
S: 8;
/** Unicode flag */
U: 16;
/** Sticky flag */
Y: 32;
/** Indices flag */
D: 64;
/** Unicode sets flag */
V: 128;
};
export type JSXElementName =
| JSXIdentifier
| JSXNamespacedName
| JSXMemberExpression;
export type JSXMemberExpressionObject = JSXIdentifier | JSXMemberExpression;

View file

@ -21,8 +21,7 @@ define_generator!(TypescriptGenerator);
impl Generator for TypescriptGenerator {
fn generate(&mut self, ctx: &LateCtx) -> Output {
let mut code = format!("{CUSTOM_TYPESCRIPT}\n");
let mut code = String::new();
for def in ctx.schema() {
if !def.generates_derive("ESTree") {
continue;
@ -37,6 +36,8 @@ impl Generator for TypescriptGenerator {
code.push_str("\n\n");
}
code.push_str(CUSTOM_TYPESCRIPT);
Output::Javascript { path: format!("{}/types.d.ts", crate::TYPESCRIPT_PACKAGE), code }
}
}