Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions npm/oxc-types/types.d.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
5 changes: 3 additions & 2 deletions tasks/ast_tools/src/generators/typescript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 }
}
}
Expand Down