From 1145341a92e433272b09786935cc4ffff177dbf0 Mon Sep 17 00:00:00 2001 From: ottomated <31470743+ottomated@users.noreply.github.com> Date: Thu, 24 Oct 2024 13:08:57 +0000 Subject: [PATCH] feat(ast_tools): output typescript to a separate package (#6755) Part of #6347. Moves typescript logic from derive_estree into a new ast_tools generator. --- .github/.generated_ast_watch_list.yml | 1 + .github/workflows/ci.yml | 28 +- .github/workflows/release_types.yml | 54 + Cargo.lock | 3 - crates/oxc_ast/Cargo.toml | 2 - crates/oxc_ast/src/ast/literal.rs | 23 - crates/oxc_ast/src/ast/types.d.ts | 32 + crates/oxc_ast/src/ast_impl/jsx.rs | 7 - crates/oxc_ast/src/generated/derive_estree.rs | 795 ------- crates/oxc_ast/src/serialize.rs | 11 - crates/oxc_regular_expression/Cargo.toml | 3 +- .../src/generated/derive_estree.rs | 88 - crates/oxc_span/Cargo.toml | 3 +- .../oxc_span/src/generated/derive_estree.rs | 18 - .../oxc_syntax/src/generated/derive_estree.rs | 16 - crates/oxc_wasm/package.json | 30 + crates/oxc_wasm/src/lib.rs | 6 + justfile | 1 + npm/oxc-types/README.md | 3 + npm/oxc-types/package.json | 27 + npm/oxc-types/src/generated/types.d.ts | 2010 +++++++++++++++++ npm/oxc-types/src/index.d.ts | 1 + pnpm-lock.yaml | 28 +- pnpm-workspace.yaml | 1 + tasks/ast_tools/src/derives/estree.rs | 90 +- tasks/ast_tools/src/generators/mod.rs | 13 +- tasks/ast_tools/src/generators/typescript.rs | 170 ++ tasks/ast_tools/src/main.rs | 4 +- wasm/parser/package.json | 3 + wasm/parser/src/lib.rs | 6 + 30 files changed, 2406 insertions(+), 1071 deletions(-) create mode 100644 .github/workflows/release_types.yml create mode 100644 crates/oxc_ast/src/ast/types.d.ts create mode 100644 crates/oxc_wasm/package.json create mode 100644 npm/oxc-types/README.md create mode 100644 npm/oxc-types/package.json create mode 100644 npm/oxc-types/src/generated/types.d.ts create mode 100644 npm/oxc-types/src/index.d.ts create mode 100644 tasks/ast_tools/src/generators/typescript.rs diff --git a/.github/.generated_ast_watch_list.yml b/.github/.generated_ast_watch_list.yml index 542c3a26c2b48..40be7863e3da6 100644 --- a/.github/.generated_ast_watch_list.yml +++ b/.github/.generated_ast_watch_list.yml @@ -32,5 +32,6 @@ src: - 'crates/oxc_ast/src/generated/ast_builder.rs' - 'crates/oxc_ast/src/generated/visit.rs' - 'crates/oxc_ast/src/generated/visit_mut.rs' + - 'npm/oxc-types/src/generated/types.d.ts' - 'tasks/ast_tools/src/**' - '.github/.generated_ast_watch_list.yml' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 762432a01bc2c..dfca88e266250 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -125,18 +125,20 @@ jobs: with: cache-key: wasm save-cache: ${{ github.ref_name == 'main' }} - tools: wasm-pack + tools: wasm-pack,just - name: Check run: | rustup target add wasm32-unknown-unknown cargo check -p oxc_wasm --target wasm32-unknown-unknown + - uses: ./.github/actions/pnpm - name: Build run: | - wasm-pack build --target web --dev ./crates/oxc_wasm - wasm-pack build --target web --dev ./wasm/parser - - uses: ./.github/actions/pnpm + just build-wasm debug + cd ./wasm/parser && pnpm build - name: Check output types - run: npx -y -p typescript tsc --lib es2020,dom crates/oxc_wasm/pkg/oxc_wasm.d.ts + run: | + pnpm install + npx -y -p typescript tsc --lib es2020,dom npm/oxc-wasm/oxc_wasm.d.ts typos: name: Spell Check @@ -262,9 +264,17 @@ jobs: if: steps.filter.outputs.src == 'true' with: components: rustfmt + tools: dprint cache-key: ast_changes save-cache: ${{ github.ref_name == 'main' }} + - name: Restore dprint plugin cache + id: cache-restore + uses: actions/cache/restore@v4 + with: + key: dprint-autofix-ci-${{ runner.os }}-${{ hashFiles('dprint.json') }} + path: ~/.cache/dprint + - name: Check AST Changes if: steps.filter.outputs.src == 'true' run: | @@ -272,6 +282,14 @@ jobs: git diff --exit-code || (echo 'AST changes caused the "generated" code to get outdated. Have you forgotten to run the `just ast` command and/or commit generated codes?' && exit 1) + - name: Save dprint plugin cache + if: ${{ github.ref_name == 'main' }} + id: cache-save + uses: actions/cache/save@v4 + with: + key: ${{ steps.cache-restore.outputs.cache-primary-key }} + path: ~/.cache/dprint + napi: name: Test NAPI runs-on: ubuntu-latest diff --git a/.github/workflows/release_types.yml b/.github/workflows/release_types.yml new file mode 100644 index 0000000000000..5ba137eae5050 --- /dev/null +++ b/.github/workflows/release_types.yml @@ -0,0 +1,54 @@ +name: Release @oxc/types + +on: + workflow_dispatch: + push: + branches: + - main + paths: + - npm/oxc-types/package.json # Please only commit this file, so we don't need to wait for all the other CI jobs to finish. + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + check: + name: Check version + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + version_changed: ${{ steps.version.outputs.changed }} + steps: + - uses: taiki-e/checkout-action@v1 + + - name: Check version changes + uses: EndBug/version-check@v2 + id: version + with: + static-checking: localIsNew + file-url: https://unpkg.com/@oxc/types/package.json + file-name: npm/oxc-types/package.json + + - name: Set version name + if: steps.version.outputs.changed == 'true' + run: | + echo "Version change found! New version: ${{ steps.version.outputs.version }} (${{ steps.version.outputs.version_type }})" + + build: + needs: check + if: needs.check.outputs.version_changed == 'true' + name: Release @oxc/types + runs-on: ubuntu-latest + permissions: + id-token: write # for `pnpm publish --provenance` + steps: + - uses: taiki-e/checkout-action@v1 + + - uses: ./.github/actions/pnpm + + - name: Publish + working-directory: npm/oxc-types + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: pnpm publish --provenance --access public diff --git a/Cargo.lock b/Cargo.lock index 66fab9dcb7693..ad2a9dc5f877c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1453,7 +1453,6 @@ dependencies = [ "oxc_syntax", "serde", "serde_json", - "wasm-bindgen", ] [[package]] @@ -1865,7 +1864,6 @@ dependencies = [ "rustc-hash", "serde", "unicode-id-start", - "wasm-bindgen", ] [[package]] @@ -1937,7 +1935,6 @@ dependencies = [ "oxc_estree", "schemars", "serde", - "wasm-bindgen", ] [[package]] diff --git a/crates/oxc_ast/Cargo.toml b/crates/oxc_ast/Cargo.toml index 1604510fe667a..ba0aa62ddb739 100644 --- a/crates/oxc_ast/Cargo.toml +++ b/crates/oxc_ast/Cargo.toml @@ -31,14 +31,12 @@ num-bigint = { workspace = true } serde = { workspace = true, features = ["derive"], optional = true } serde_json = { workspace = true, optional = true } -wasm-bindgen = { workspace = true, optional = true } [features] default = [] serialize = [ "dep:serde", "dep:serde_json", - "dep:wasm-bindgen", "oxc_allocator/serialize", "oxc_regular_expression/serialize", "oxc_span/serialize", diff --git a/crates/oxc_ast/src/ast/literal.rs b/crates/oxc_ast/src/ast/literal.rs index 4449efc82dbda..d5a411fc788a8 100644 --- a/crates/oxc_ast/src/ast/literal.rs +++ b/crates/oxc_ast/src/ast/literal.rs @@ -190,26 +190,3 @@ bitflags! { const V = 1 << 7; } } - -#[cfg(feature = "serialize")] -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = r#" -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 -}; -"#; diff --git a/crates/oxc_ast/src/ast/types.d.ts b/crates/oxc_ast/src/ast/types.d.ts new file mode 100644 index 0000000000000..3339065a0acd9 --- /dev/null +++ b/crates/oxc_ast/src/ast/types.d.ts @@ -0,0 +1,32 @@ +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; diff --git a/crates/oxc_ast/src/ast_impl/jsx.rs b/crates/oxc_ast/src/ast_impl/jsx.rs index cab22299c1a55..205da800aa2bd 100644 --- a/crates/oxc_ast/src/ast_impl/jsx.rs +++ b/crates/oxc_ast/src/ast_impl/jsx.rs @@ -5,13 +5,6 @@ use oxc_span::Atom; use crate::ast::*; -#[cfg(feature = "serialize")] -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = r#" -export type JSXElementName = JSXIdentifier | JSXNamespacedName | JSXMemberExpression; -export type JSXMemberExpressionObject = JSXIdentifier | JSXMemberExpression; -"#; - // 1.2 JSX Elements impl<'a> fmt::Display for JSXIdentifier<'a> { diff --git a/crates/oxc_ast/src/generated/derive_estree.rs b/crates/oxc_ast/src/generated/derive_estree.rs index 404abe5b357a8..085ec0e2fc07c 100644 --- a/crates/oxc_ast/src/generated/derive_estree.rs +++ b/crates/oxc_ast/src/generated/derive_estree.rs @@ -27,10 +27,6 @@ impl Serialize for BooleanLiteral { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type BooleanLiteral = ({\n\ttype: 'BooleanLiteral';\n\tvalue: boolean;\n}) & Span;"; - impl Serialize for NullLiteral { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -40,10 +36,6 @@ impl Serialize for NullLiteral { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type NullLiteral = ({\n\ttype: 'NullLiteral';\n}) & Span;"; - impl<'a> Serialize for NumericLiteral<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -55,9 +47,6 @@ impl<'a> Serialize for NumericLiteral<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type NumericLiteral = ({\n\ttype: 'NumericLiteral';\n\tvalue: number;\n\traw: string;\n}) & Span;"; - impl<'a> Serialize for BigIntLiteral<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -68,10 +57,6 @@ impl<'a> Serialize for BigIntLiteral<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type BigIntLiteral = ({\n\ttype: 'BigIntLiteral';\n\traw: string;\n}) & Span;"; - impl<'a> Serialize for RegExpLiteral<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -83,9 +68,6 @@ impl<'a> Serialize for RegExpLiteral<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type RegExpLiteral = ({\n\ttype: 'RegExpLiteral';\n\tvalue: EmptyObject;\n\tregex: RegExp;\n}) & Span;"; - impl<'a> Serialize for RegExp<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -95,10 +77,6 @@ impl<'a> Serialize for RegExp<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type RegExp = ({\n\tpattern: RegExpPattern;\n\tflags: RegExpFlags;\n});"; - impl<'a> Serialize for RegExpPattern<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -109,9 +87,6 @@ impl<'a> Serialize for RegExpPattern<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type RegExpPattern = string | string | Pattern;"; - impl Serialize for EmptyObject { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -119,9 +94,6 @@ impl Serialize for EmptyObject { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type EmptyObject = ({\n});"; - impl<'a> Serialize for StringLiteral<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -132,10 +104,6 @@ impl<'a> Serialize for StringLiteral<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type StringLiteral = ({\n\ttype: 'StringLiteral';\n\tvalue: string;\n}) & Span;"; - impl<'a> Serialize for Program<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -149,9 +117,6 @@ impl<'a> Serialize for Program<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type Program = ({\n\ttype: 'Program';\n\tsourceType: SourceType;\n\thashbang: (Hashbang) | null;\n\tdirectives: Array;\n\tbody: Array;\n}) & Span;"; - impl<'a> Serialize for Expression<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -201,9 +166,6 @@ impl<'a> Serialize for Expression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type Expression = BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | StringLiteral | TemplateLiteral | IdentifierReference | MetaProperty | Super | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | Class | ConditionalExpression | Function | ImportExpression | LogicalExpression | NewExpression | ObjectExpression | ParenthesizedExpression | SequenceExpression | TaggedTemplateExpression | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | PrivateInExpression | JSXElement | JSXFragment | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression | TSInstantiationExpression | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression;"; - impl<'a> Serialize for IdentifierName<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -214,10 +176,6 @@ impl<'a> Serialize for IdentifierName<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type IdentifierName = ({\n\ttype: 'Identifier';\n\tname: string;\n}) & Span;"; - impl<'a> Serialize for IdentifierReference<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -228,10 +186,6 @@ impl<'a> Serialize for IdentifierReference<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type IdentifierReference = ({\n\ttype: 'Identifier';\n\tname: string;\n}) & Span;"; - impl<'a> Serialize for BindingIdentifier<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -242,10 +196,6 @@ impl<'a> Serialize for BindingIdentifier<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type BindingIdentifier = ({\n\ttype: 'Identifier';\n\tname: string;\n}) & Span;"; - impl<'a> Serialize for LabelIdentifier<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -256,10 +206,6 @@ impl<'a> Serialize for LabelIdentifier<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type LabelIdentifier = ({\n\ttype: 'Identifier';\n\tname: string;\n}) & Span;"; - impl Serialize for ThisExpression { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -269,10 +215,6 @@ impl Serialize for ThisExpression { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type ThisExpression = ({\n\ttype: 'ThisExpression';\n}) & Span;"; - impl<'a> Serialize for ArrayExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -283,9 +225,6 @@ impl<'a> Serialize for ArrayExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ArrayExpression = ({\n\ttype: 'ArrayExpression';\n\telements: Array;\n}) & Span;"; - impl<'a> Serialize for ArrayExpressionElement<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -361,9 +300,6 @@ impl<'a> Serialize for ObjectExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ObjectExpression = ({\n\ttype: 'ObjectExpression';\n\tproperties: Array;\n}) & Span;"; - impl<'a> Serialize for ObjectPropertyKind<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -373,10 +309,6 @@ impl<'a> Serialize for ObjectPropertyKind<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type ObjectPropertyKind = ObjectProperty | SpreadElement;"; - impl<'a> Serialize for ObjectProperty<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -393,9 +325,6 @@ impl<'a> Serialize for ObjectProperty<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ObjectProperty = ({\n\ttype: 'ObjectProperty';\n\tkind: PropertyKind;\n\tkey: PropertyKey;\n\tvalue: Expression;\n\tinit: (Expression) | null;\n\tmethod: boolean;\n\tshorthand: boolean;\n\tcomputed: boolean;\n}) & Span;"; - impl<'a> Serialize for PropertyKey<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -447,9 +376,6 @@ impl<'a> Serialize for PropertyKey<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type PropertyKey = IdentifierName | PrivateIdentifier | BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | StringLiteral | TemplateLiteral | IdentifierReference | MetaProperty | Super | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | Class | ConditionalExpression | Function | ImportExpression | LogicalExpression | NewExpression | ObjectExpression | ParenthesizedExpression | SequenceExpression | TaggedTemplateExpression | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | PrivateInExpression | JSXElement | JSXFragment | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression | TSInstantiationExpression | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression;"; - impl Serialize for PropertyKind { fn serialize(&self, serializer: S) -> Result { match *self { @@ -460,9 +386,6 @@ impl Serialize for PropertyKind { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type PropertyKind = 'init' | 'get' | 'set';"; - impl<'a> Serialize for TemplateLiteral<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -474,9 +397,6 @@ impl<'a> Serialize for TemplateLiteral<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TemplateLiteral = ({\n\ttype: 'TemplateLiteral';\n\tquasis: Array;\n\texpressions: Array;\n}) & Span;"; - impl<'a> Serialize for TaggedTemplateExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -489,9 +409,6 @@ impl<'a> Serialize for TaggedTemplateExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TaggedTemplateExpression = ({\n\ttype: 'TaggedTemplateExpression';\n\ttag: Expression;\n\tquasi: TemplateLiteral;\n\ttypeParameters: (TSTypeParameterInstantiation) | null;\n}) & Span;"; - impl<'a> Serialize for TemplateElement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -503,9 +420,6 @@ impl<'a> Serialize for TemplateElement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TemplateElement = ({\n\ttype: 'TemplateElement';\n\ttail: boolean;\n\tvalue: TemplateElementValue;\n}) & Span;"; - impl<'a> Serialize for TemplateElementValue<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -515,10 +429,6 @@ impl<'a> Serialize for TemplateElementValue<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TemplateElementValue = ({\n\traw: string;\n\tcooked: (string) | null;\n});"; - impl<'a> Serialize for MemberExpression<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -529,9 +439,6 @@ impl<'a> Serialize for MemberExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type MemberExpression = ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression;"; - impl<'a> Serialize for ComputedMemberExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -544,9 +451,6 @@ impl<'a> Serialize for ComputedMemberExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ComputedMemberExpression = ({\n\ttype: 'ComputedMemberExpression';\n\tobject: Expression;\n\texpression: Expression;\n\toptional: boolean;\n}) & Span;"; - impl<'a> Serialize for StaticMemberExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -559,9 +463,6 @@ impl<'a> Serialize for StaticMemberExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type StaticMemberExpression = ({\n\ttype: 'StaticMemberExpression';\n\tobject: Expression;\n\tproperty: IdentifierName;\n\toptional: boolean;\n}) & Span;"; - impl<'a> Serialize for PrivateFieldExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -574,9 +475,6 @@ impl<'a> Serialize for PrivateFieldExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type PrivateFieldExpression = ({\n\ttype: 'PrivateFieldExpression';\n\tobject: Expression;\n\tfield: PrivateIdentifier;\n\toptional: boolean;\n}) & Span;"; - impl<'a> Serialize for CallExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -590,9 +488,6 @@ impl<'a> Serialize for CallExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type CallExpression = ({\n\ttype: 'CallExpression';\n\tcallee: Expression;\n\ttypeParameters: (TSTypeParameterInstantiation) | null;\n\targuments: Array;\n\toptional: boolean;\n}) & Span;"; - impl<'a> Serialize for NewExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -605,9 +500,6 @@ impl<'a> Serialize for NewExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type NewExpression = ({\n\ttype: 'NewExpression';\n\tcallee: Expression;\n\targuments: Array;\n\ttypeParameters: (TSTypeParameterInstantiation) | null;\n}) & Span;"; - impl<'a> Serialize for MetaProperty<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -619,9 +511,6 @@ impl<'a> Serialize for MetaProperty<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type MetaProperty = ({\n\ttype: 'MetaProperty';\n\tmeta: IdentifierName;\n\tproperty: IdentifierName;\n}) & Span;"; - impl<'a> Serialize for SpreadElement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -632,10 +521,6 @@ impl<'a> Serialize for SpreadElement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type SpreadElement = ({\n\ttype: 'SpreadElement';\n\targument: Expression;\n}) & Span;"; - impl<'a> Serialize for Argument<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -686,9 +571,6 @@ impl<'a> Serialize for Argument<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type Argument = SpreadElement | BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | StringLiteral | TemplateLiteral | IdentifierReference | MetaProperty | Super | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | Class | ConditionalExpression | Function | ImportExpression | LogicalExpression | NewExpression | ObjectExpression | ParenthesizedExpression | SequenceExpression | TaggedTemplateExpression | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | PrivateInExpression | JSXElement | JSXFragment | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression | TSInstantiationExpression | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression;"; - impl<'a> Serialize for UpdateExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -701,9 +583,6 @@ impl<'a> Serialize for UpdateExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type UpdateExpression = ({\n\ttype: 'UpdateExpression';\n\toperator: UpdateOperator;\n\tprefix: boolean;\n\targument: SimpleAssignmentTarget;\n}) & Span;"; - impl<'a> Serialize for UnaryExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -715,9 +594,6 @@ impl<'a> Serialize for UnaryExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type UnaryExpression = ({\n\ttype: 'UnaryExpression';\n\toperator: UnaryOperator;\n\targument: Expression;\n}) & Span;"; - impl<'a> Serialize for BinaryExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -730,9 +606,6 @@ impl<'a> Serialize for BinaryExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type BinaryExpression = ({\n\ttype: 'BinaryExpression';\n\tleft: Expression;\n\toperator: BinaryOperator;\n\tright: Expression;\n}) & Span;"; - impl<'a> Serialize for PrivateInExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -745,9 +618,6 @@ impl<'a> Serialize for PrivateInExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type PrivateInExpression = ({\n\ttype: 'PrivateInExpression';\n\tleft: PrivateIdentifier;\n\toperator: BinaryOperator;\n\tright: Expression;\n}) & Span;"; - impl<'a> Serialize for LogicalExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -760,9 +630,6 @@ impl<'a> Serialize for LogicalExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type LogicalExpression = ({\n\ttype: 'LogicalExpression';\n\tleft: Expression;\n\toperator: LogicalOperator;\n\tright: Expression;\n}) & Span;"; - impl<'a> Serialize for ConditionalExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -775,9 +642,6 @@ impl<'a> Serialize for ConditionalExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ConditionalExpression = ({\n\ttype: 'ConditionalExpression';\n\ttest: Expression;\n\tconsequent: Expression;\n\talternate: Expression;\n}) & Span;"; - impl<'a> Serialize for AssignmentExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -790,9 +654,6 @@ impl<'a> Serialize for AssignmentExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type AssignmentExpression = ({\n\ttype: 'AssignmentExpression';\n\toperator: AssignmentOperator;\n\tleft: AssignmentTarget;\n\tright: Expression;\n}) & Span;"; - impl<'a> Serialize for AssignmentTarget<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -811,9 +672,6 @@ impl<'a> Serialize for AssignmentTarget<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type AssignmentTarget = IdentifierReference | TSAsExpression | TSSatisfiesExpression | TSNonNullExpression | TSTypeAssertion | TSInstantiationExpression | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression | ArrayAssignmentTarget | ObjectAssignmentTarget;"; - impl<'a> Serialize for SimpleAssignmentTarget<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -840,9 +698,6 @@ impl<'a> Serialize for SimpleAssignmentTarget<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type SimpleAssignmentTarget = IdentifierReference | TSAsExpression | TSSatisfiesExpression | TSNonNullExpression | TSTypeAssertion | TSInstantiationExpression | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression;"; - impl<'a> Serialize for AssignmentTargetPattern<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -856,16 +711,6 @@ impl<'a> Serialize for AssignmentTargetPattern<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type AssignmentTargetPattern = ArrayAssignmentTarget | ObjectAssignmentTarget;"; - -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ArrayAssignmentTarget = ({\n\ttype: 'ArrayAssignmentTarget';\n\telements: Array;\n}) & Span;"; - -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ObjectAssignmentTarget = ({\n\ttype: 'ObjectAssignmentTarget';\n\tproperties: Array;\n}) & Span;"; - impl<'a> Serialize for AssignmentTargetRest<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -876,9 +721,6 @@ impl<'a> Serialize for AssignmentTargetRest<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type AssignmentTargetRest = ({\n\ttype: 'RestElement';\n\targument: AssignmentTarget;\n}) & Span;"; - impl<'a> Serialize for AssignmentTargetMaybeDefault<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -918,9 +760,6 @@ impl<'a> Serialize for AssignmentTargetMaybeDefault<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type AssignmentTargetMaybeDefault = AssignmentTargetWithDefault | IdentifierReference | TSAsExpression | TSSatisfiesExpression | TSNonNullExpression | TSTypeAssertion | TSInstantiationExpression | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression | ArrayAssignmentTarget | ObjectAssignmentTarget;"; - impl<'a> Serialize for AssignmentTargetWithDefault<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -932,9 +771,6 @@ impl<'a> Serialize for AssignmentTargetWithDefault<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type AssignmentTargetWithDefault = ({\n\ttype: 'AssignmentTargetWithDefault';\n\tbinding: AssignmentTarget;\n\tinit: Expression;\n}) & Span;"; - impl<'a> Serialize for AssignmentTargetProperty<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -948,9 +784,6 @@ impl<'a> Serialize for AssignmentTargetProperty<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type AssignmentTargetProperty = AssignmentTargetPropertyIdentifier | AssignmentTargetPropertyProperty;"; - impl<'a> Serialize for AssignmentTargetPropertyIdentifier<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -962,9 +795,6 @@ impl<'a> Serialize for AssignmentTargetPropertyIdentifier<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type AssignmentTargetPropertyIdentifier = ({\n\ttype: 'AssignmentTargetPropertyIdentifier';\n\tbinding: IdentifierReference;\n\tinit: (Expression) | null;\n}) & Span;"; - impl<'a> Serialize for AssignmentTargetPropertyProperty<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -976,9 +806,6 @@ impl<'a> Serialize for AssignmentTargetPropertyProperty<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type AssignmentTargetPropertyProperty = ({\n\ttype: 'AssignmentTargetPropertyProperty';\n\tname: PropertyKey;\n\tbinding: AssignmentTargetMaybeDefault;\n}) & Span;"; - impl<'a> Serialize for SequenceExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -989,9 +816,6 @@ impl<'a> Serialize for SequenceExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type SequenceExpression = ({\n\ttype: 'SequenceExpression';\n\texpressions: Array;\n}) & Span;"; - impl Serialize for Super { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1001,9 +825,6 @@ impl Serialize for Super { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type Super = ({\n\ttype: 'Super';\n}) & Span;"; - impl<'a> Serialize for AwaitExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1014,9 +835,6 @@ impl<'a> Serialize for AwaitExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type AwaitExpression = ({\n\ttype: 'AwaitExpression';\n\targument: Expression;\n}) & Span;"; - impl<'a> Serialize for ChainExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1027,9 +845,6 @@ impl<'a> Serialize for ChainExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ChainExpression = ({\n\ttype: 'ChainExpression';\n\texpression: ChainElement;\n}) & Span;"; - impl<'a> Serialize for ChainElement<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -1041,9 +856,6 @@ impl<'a> Serialize for ChainElement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ChainElement = CallExpression | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression;"; - impl<'a> Serialize for ParenthesizedExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1054,9 +866,6 @@ impl<'a> Serialize for ParenthesizedExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ParenthesizedExpression = ({\n\ttype: 'ParenthesizedExpression';\n\texpression: Expression;\n}) & Span;"; - impl<'a> Serialize for Statement<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -1096,9 +905,6 @@ impl<'a> Serialize for Statement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type Statement = BlockStatement | BreakStatement | ContinueStatement | DebuggerStatement | DoWhileStatement | EmptyStatement | ExpressionStatement | ForInStatement | ForOfStatement | ForStatement | IfStatement | LabeledStatement | ReturnStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | WithStatement | VariableDeclaration | Function | Class | TSTypeAliasDeclaration | TSInterfaceDeclaration | TSEnumDeclaration | TSModuleDeclaration | TSImportEqualsDeclaration | ImportDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | TSExportAssignment | TSNamespaceExportDeclaration;"; - impl<'a> Serialize for Directive<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1110,9 +916,6 @@ impl<'a> Serialize for Directive<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type Directive = ({\n\ttype: 'Directive';\n\texpression: StringLiteral;\n\tdirective: string;\n}) & Span;"; - impl<'a> Serialize for Hashbang<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1123,10 +926,6 @@ impl<'a> Serialize for Hashbang<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type Hashbang = ({\n\ttype: 'Hashbang';\n\tvalue: string;\n}) & Span;"; - impl<'a> Serialize for BlockStatement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1137,9 +936,6 @@ impl<'a> Serialize for BlockStatement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type BlockStatement = ({\n\ttype: 'BlockStatement';\n\tbody: Array;\n}) & Span;"; - impl<'a> Serialize for Declaration<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -1155,9 +951,6 @@ impl<'a> Serialize for Declaration<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type Declaration = VariableDeclaration | Function | Class | TSTypeAliasDeclaration | TSInterfaceDeclaration | TSEnumDeclaration | TSModuleDeclaration | TSImportEqualsDeclaration;"; - impl<'a> Serialize for VariableDeclaration<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1170,9 +963,6 @@ impl<'a> Serialize for VariableDeclaration<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type VariableDeclaration = ({\n\ttype: 'VariableDeclaration';\n\tkind: VariableDeclarationKind;\n\tdeclarations: Array;\n\tdeclare: boolean;\n}) & Span;"; - impl Serialize for VariableDeclarationKind { fn serialize(&self, serializer: S) -> Result { match *self { @@ -1195,10 +985,6 @@ impl Serialize for VariableDeclarationKind { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type VariableDeclarationKind = 'var' | 'const' | 'let' | 'using' | 'await using';"; - impl<'a> Serialize for VariableDeclarator<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1211,9 +997,6 @@ impl<'a> Serialize for VariableDeclarator<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type VariableDeclarator = ({\n\ttype: 'VariableDeclarator';\n\tid: BindingPattern;\n\tinit: (Expression) | null;\n\tdefinite: boolean;\n}) & Span;"; - impl Serialize for EmptyStatement { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1223,10 +1006,6 @@ impl Serialize for EmptyStatement { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type EmptyStatement = ({\n\ttype: 'EmptyStatement';\n}) & Span;"; - impl<'a> Serialize for ExpressionStatement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1237,9 +1016,6 @@ impl<'a> Serialize for ExpressionStatement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ExpressionStatement = ({\n\ttype: 'ExpressionStatement';\n\texpression: Expression;\n}) & Span;"; - impl<'a> Serialize for IfStatement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1252,9 +1028,6 @@ impl<'a> Serialize for IfStatement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type IfStatement = ({\n\ttype: 'IfStatement';\n\ttest: Expression;\n\tconsequent: Statement;\n\talternate: (Statement) | null;\n}) & Span;"; - impl<'a> Serialize for DoWhileStatement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1266,9 +1039,6 @@ impl<'a> Serialize for DoWhileStatement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type DoWhileStatement = ({\n\ttype: 'DoWhileStatement';\n\tbody: Statement;\n\ttest: Expression;\n}) & Span;"; - impl<'a> Serialize for WhileStatement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1280,9 +1050,6 @@ impl<'a> Serialize for WhileStatement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type WhileStatement = ({\n\ttype: 'WhileStatement';\n\ttest: Expression;\n\tbody: Statement;\n}) & Span;"; - impl<'a> Serialize for ForStatement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1296,9 +1063,6 @@ impl<'a> Serialize for ForStatement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ForStatement = ({\n\ttype: 'ForStatement';\n\tinit: (ForStatementInit) | null;\n\ttest: (Expression) | null;\n\tupdate: (Expression) | null;\n\tbody: Statement;\n}) & Span;"; - impl<'a> Serialize for ForStatementInit<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -1349,9 +1113,6 @@ impl<'a> Serialize for ForStatementInit<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ForStatementInit = VariableDeclaration | BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | StringLiteral | TemplateLiteral | IdentifierReference | MetaProperty | Super | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | Class | ConditionalExpression | Function | ImportExpression | LogicalExpression | NewExpression | ObjectExpression | ParenthesizedExpression | SequenceExpression | TaggedTemplateExpression | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | PrivateInExpression | JSXElement | JSXFragment | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression | TSInstantiationExpression | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression;"; - impl<'a> Serialize for ForInStatement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1364,9 +1125,6 @@ impl<'a> Serialize for ForInStatement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ForInStatement = ({\n\ttype: 'ForInStatement';\n\tleft: ForStatementLeft;\n\tright: Expression;\n\tbody: Statement;\n}) & Span;"; - impl<'a> Serialize for ForStatementLeft<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -1386,9 +1144,6 @@ impl<'a> Serialize for ForStatementLeft<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ForStatementLeft = VariableDeclaration | IdentifierReference | TSAsExpression | TSSatisfiesExpression | TSNonNullExpression | TSTypeAssertion | TSInstantiationExpression | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression | ArrayAssignmentTarget | ObjectAssignmentTarget;"; - impl<'a> Serialize for ForOfStatement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1402,9 +1157,6 @@ impl<'a> Serialize for ForOfStatement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ForOfStatement = ({\n\ttype: 'ForOfStatement';\n\tawait: boolean;\n\tleft: ForStatementLeft;\n\tright: Expression;\n\tbody: Statement;\n}) & Span;"; - impl<'a> Serialize for ContinueStatement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1415,9 +1167,6 @@ impl<'a> Serialize for ContinueStatement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ContinueStatement = ({\n\ttype: 'ContinueStatement';\n\tlabel: (LabelIdentifier) | null;\n}) & Span;"; - impl<'a> Serialize for BreakStatement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1428,9 +1177,6 @@ impl<'a> Serialize for BreakStatement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type BreakStatement = ({\n\ttype: 'BreakStatement';\n\tlabel: (LabelIdentifier) | null;\n}) & Span;"; - impl<'a> Serialize for ReturnStatement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1441,9 +1187,6 @@ impl<'a> Serialize for ReturnStatement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ReturnStatement = ({\n\ttype: 'ReturnStatement';\n\targument: (Expression) | null;\n}) & Span;"; - impl<'a> Serialize for WithStatement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1455,9 +1198,6 @@ impl<'a> Serialize for WithStatement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type WithStatement = ({\n\ttype: 'WithStatement';\n\tobject: Expression;\n\tbody: Statement;\n}) & Span;"; - impl<'a> Serialize for SwitchStatement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1469,9 +1209,6 @@ impl<'a> Serialize for SwitchStatement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type SwitchStatement = ({\n\ttype: 'SwitchStatement';\n\tdiscriminant: Expression;\n\tcases: Array;\n}) & Span;"; - impl<'a> Serialize for SwitchCase<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1483,9 +1220,6 @@ impl<'a> Serialize for SwitchCase<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type SwitchCase = ({\n\ttype: 'SwitchCase';\n\ttest: (Expression) | null;\n\tconsequent: Array;\n}) & Span;"; - impl<'a> Serialize for LabeledStatement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1497,9 +1231,6 @@ impl<'a> Serialize for LabeledStatement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type LabeledStatement = ({\n\ttype: 'LabeledStatement';\n\tlabel: LabelIdentifier;\n\tbody: Statement;\n}) & Span;"; - impl<'a> Serialize for ThrowStatement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1510,9 +1241,6 @@ impl<'a> Serialize for ThrowStatement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ThrowStatement = ({\n\ttype: 'ThrowStatement';\n\targument: Expression;\n}) & Span;"; - impl<'a> Serialize for TryStatement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1525,9 +1253,6 @@ impl<'a> Serialize for TryStatement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TryStatement = ({\n\ttype: 'TryStatement';\n\tblock: BlockStatement;\n\thandler: (CatchClause) | null;\n\tfinalizer: (BlockStatement) | null;\n}) & Span;"; - impl<'a> Serialize for CatchClause<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1539,9 +1264,6 @@ impl<'a> Serialize for CatchClause<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type CatchClause = ({\n\ttype: 'CatchClause';\n\tparam: (CatchParameter) | null;\n\tbody: BlockStatement;\n}) & Span;"; - impl<'a> Serialize for CatchParameter<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1552,9 +1274,6 @@ impl<'a> Serialize for CatchParameter<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type CatchParameter = ({\n\ttype: 'CatchParameter';\n\tpattern: BindingPattern;\n}) & Span;"; - impl Serialize for DebuggerStatement { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1564,10 +1283,6 @@ impl Serialize for DebuggerStatement { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type DebuggerStatement = ({\n\ttype: 'DebuggerStatement';\n}) & Span;"; - impl<'a> Serialize for BindingPattern<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1578,9 +1293,6 @@ impl<'a> Serialize for BindingPattern<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type BindingPattern = ({\n\ttypeAnnotation: (TSTypeAnnotation) | null;\n\toptional: boolean;\n}) & (BindingIdentifier | ObjectPattern | ArrayPattern | AssignmentPattern);"; - impl<'a> Serialize for BindingPatternKind<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -1592,9 +1304,6 @@ impl<'a> Serialize for BindingPatternKind<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type BindingPatternKind = BindingIdentifier | ObjectPattern | ArrayPattern | AssignmentPattern;"; - impl<'a> Serialize for AssignmentPattern<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1606,12 +1315,6 @@ impl<'a> Serialize for AssignmentPattern<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type AssignmentPattern = ({\n\ttype: 'AssignmentPattern';\n\tleft: BindingPattern;\n\tright: Expression;\n}) & Span;"; - -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ObjectPattern = ({\n\ttype: 'ObjectPattern';\n\tproperties: Array;\n}) & Span;"; - impl<'a> Serialize for BindingProperty<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1625,12 +1328,6 @@ impl<'a> Serialize for BindingProperty<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type BindingProperty = ({\n\ttype: 'BindingProperty';\n\tkey: PropertyKey;\n\tvalue: BindingPattern;\n\tshorthand: boolean;\n\tcomputed: boolean;\n}) & Span;"; - -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ArrayPattern = ({\n\ttype: 'ArrayPattern';\n\telements: Array;\n}) & Span;"; - impl<'a> Serialize for BindingRestElement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1641,9 +1338,6 @@ impl<'a> Serialize for BindingRestElement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type BindingRestElement = ({\n\ttype: 'RestElement';\n\targument: BindingPattern;\n}) & Span;"; - impl<'a> Serialize for Function<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1662,9 +1356,6 @@ impl<'a> Serialize for Function<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type Function = ({\n\ttype: FunctionType;\n\tid: (BindingIdentifier) | null;\n\tgenerator: boolean;\n\tasync: boolean;\n\tdeclare: boolean;\n\ttypeParameters: (TSTypeParameterDeclaration) | null;\n\tthisParam: (TSThisParameter) | null;\n\tparams: FormalParameters;\n\treturnType: (TSTypeAnnotation) | null;\n\tbody: (FunctionBody) | null;\n}) & Span;"; - impl Serialize for FunctionType { fn serialize(&self, serializer: S) -> Result { match *self { @@ -1686,12 +1377,6 @@ impl Serialize for FunctionType { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type FunctionType = 'FunctionDeclaration' | 'FunctionExpression' | 'TSDeclareFunction' | 'TSEmptyBodyFunctionExpression';"; - -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type FormalParameters = ({\n\ttype: 'FormalParameters';\n\tkind: FormalParameterKind;\n\titems: Array;\n}) & Span;"; - impl<'a> Serialize for FormalParameter<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1706,9 +1391,6 @@ impl<'a> Serialize for FormalParameter<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type FormalParameter = ({\n\ttype: 'FormalParameter';\n\tdecorators: Array;\n\tpattern: BindingPattern;\n\taccessibility: (TSAccessibility) | null;\n\treadonly: boolean;\n\toverride: boolean;\n}) & Span;"; - impl Serialize for FormalParameterKind { fn serialize(&self, serializer: S) -> Result { match *self { @@ -1732,9 +1414,6 @@ impl Serialize for FormalParameterKind { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type FormalParameterKind = 'FormalParameter' | 'UniqueFormalParameters' | 'ArrowFormalParameters' | 'Signature';"; - impl<'a> Serialize for FunctionBody<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1746,9 +1425,6 @@ impl<'a> Serialize for FunctionBody<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type FunctionBody = ({\n\ttype: 'FunctionBody';\n\tdirectives: Array;\n\tstatements: Array;\n}) & Span;"; - impl<'a> Serialize for ArrowFunctionExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1764,9 +1440,6 @@ impl<'a> Serialize for ArrowFunctionExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ArrowFunctionExpression = ({\n\ttype: 'ArrowFunctionExpression';\n\texpression: boolean;\n\tasync: boolean;\n\ttypeParameters: (TSTypeParameterDeclaration) | null;\n\tparams: FormalParameters;\n\treturnType: (TSTypeAnnotation) | null;\n\tbody: FunctionBody;\n}) & Span;"; - impl<'a> Serialize for YieldExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1778,9 +1451,6 @@ impl<'a> Serialize for YieldExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type YieldExpression = ({\n\ttype: 'YieldExpression';\n\tdelegate: boolean;\n\targument: (Expression) | null;\n}) & Span;"; - impl<'a> Serialize for Class<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1799,9 +1469,6 @@ impl<'a> Serialize for Class<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type Class = ({\n\ttype: ClassType;\n\tdecorators: Array;\n\tid: (BindingIdentifier) | null;\n\ttypeParameters: (TSTypeParameterDeclaration) | null;\n\tsuperClass: (Expression) | null;\n\tsuperTypeParameters: (TSTypeParameterInstantiation) | null;\n\timplements: (Array) | null;\n\tbody: ClassBody;\n\tabstract: boolean;\n\tdeclare: boolean;\n}) & Span;"; - impl Serialize for ClassType { fn serialize(&self, serializer: S) -> Result { match *self { @@ -1815,10 +1482,6 @@ impl Serialize for ClassType { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type ClassType = 'ClassDeclaration' | 'ClassExpression';"; - impl<'a> Serialize for ClassBody<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1829,10 +1492,6 @@ impl<'a> Serialize for ClassBody<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type ClassBody = ({\n\ttype: 'ClassBody';\n\tbody: Array;\n}) & Span;"; - impl<'a> Serialize for ClassElement<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -1845,9 +1504,6 @@ impl<'a> Serialize for ClassElement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ClassElement = StaticBlock | MethodDefinition | PropertyDefinition | AccessorProperty | TSIndexSignature;"; - impl<'a> Serialize for MethodDefinition<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1866,9 +1522,6 @@ impl<'a> Serialize for MethodDefinition<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type MethodDefinition = ({\n\ttype: MethodDefinitionType;\n\tdecorators: Array;\n\tkey: PropertyKey;\n\tvalue: Function;\n\tkind: MethodDefinitionKind;\n\tcomputed: boolean;\n\tstatic: boolean;\n\toverride: boolean;\n\toptional: boolean;\n\taccessibility: (TSAccessibility) | null;\n}) & Span;"; - impl Serialize for MethodDefinitionType { fn serialize(&self, serializer: S) -> Result { match *self { @@ -1884,10 +1537,6 @@ impl Serialize for MethodDefinitionType { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type MethodDefinitionType = 'MethodDefinition' | 'TSAbstractMethodDefinition';"; - impl<'a> Serialize for PropertyDefinition<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1909,9 +1558,6 @@ impl<'a> Serialize for PropertyDefinition<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type PropertyDefinition = ({\n\ttype: PropertyDefinitionType;\n\tdecorators: Array;\n\tkey: PropertyKey;\n\tvalue: (Expression) | null;\n\tcomputed: boolean;\n\tstatic: boolean;\n\tdeclare: boolean;\n\toverride: boolean;\n\toptional: boolean;\n\tdefinite: boolean;\n\treadonly: boolean;\n\ttypeAnnotation: (TSTypeAnnotation) | null;\n\taccessibility: (TSAccessibility) | null;\n}) & Span;"; - impl Serialize for PropertyDefinitionType { fn serialize(&self, serializer: S) -> Result { match *self { @@ -1930,10 +1576,6 @@ impl Serialize for PropertyDefinitionType { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type PropertyDefinitionType = 'PropertyDefinition' | 'TSAbstractPropertyDefinition';"; - impl Serialize for MethodDefinitionKind { fn serialize(&self, serializer: S) -> Result { match *self { @@ -1953,10 +1595,6 @@ impl Serialize for MethodDefinitionKind { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type MethodDefinitionKind = 'constructor' | 'method' | 'get' | 'set';"; - impl<'a> Serialize for PrivateIdentifier<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1967,10 +1605,6 @@ impl<'a> Serialize for PrivateIdentifier<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type PrivateIdentifier = ({\n\ttype: 'PrivateIdentifier';\n\tname: string;\n}) & Span;"; - impl<'a> Serialize for StaticBlock<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -1981,10 +1615,6 @@ impl<'a> Serialize for StaticBlock<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type StaticBlock = ({\n\ttype: 'StaticBlock';\n\tbody: Array;\n}) & Span;"; - impl<'a> Serialize for ModuleDeclaration<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -2000,9 +1630,6 @@ impl<'a> Serialize for ModuleDeclaration<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ModuleDeclaration = ImportDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | TSExportAssignment | TSNamespaceExportDeclaration;"; - impl Serialize for AccessorPropertyType { fn serialize(&self, serializer: S) -> Result { match *self { @@ -2018,10 +1645,6 @@ impl Serialize for AccessorPropertyType { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type AccessorPropertyType = 'AccessorProperty' | 'TSAbstractAccessorProperty';"; - impl<'a> Serialize for AccessorProperty<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2039,9 +1662,6 @@ impl<'a> Serialize for AccessorProperty<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type AccessorProperty = ({\n\ttype: AccessorPropertyType;\n\tdecorators: Array;\n\tkey: PropertyKey;\n\tvalue: (Expression) | null;\n\tcomputed: boolean;\n\tstatic: boolean;\n\tdefinite: boolean;\n\ttypeAnnotation: (TSTypeAnnotation) | null;\n\taccessibility: (TSAccessibility) | null;\n}) & Span;"; - impl<'a> Serialize for ImportExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2053,9 +1673,6 @@ impl<'a> Serialize for ImportExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ImportExpression = ({\n\ttype: 'ImportExpression';\n\tsource: Expression;\n\targuments: Array;\n}) & Span;"; - impl<'a> Serialize for ImportDeclaration<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2069,9 +1686,6 @@ impl<'a> Serialize for ImportDeclaration<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ImportDeclaration = ({\n\ttype: 'ImportDeclaration';\n\tspecifiers: (Array) | null;\n\tsource: StringLiteral;\n\twithClause: (WithClause) | null;\n\timportKind: ImportOrExportKind;\n}) & Span;"; - impl<'a> Serialize for ImportDeclarationSpecifier<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -2086,9 +1700,6 @@ impl<'a> Serialize for ImportDeclarationSpecifier<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ImportDeclarationSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier;"; - impl<'a> Serialize for ImportSpecifier<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2101,9 +1712,6 @@ impl<'a> Serialize for ImportSpecifier<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ImportSpecifier = ({\n\ttype: 'ImportSpecifier';\n\timported: ModuleExportName;\n\tlocal: BindingIdentifier;\n\timportKind: ImportOrExportKind;\n}) & Span;"; - impl<'a> Serialize for ImportDefaultSpecifier<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2114,9 +1722,6 @@ impl<'a> Serialize for ImportDefaultSpecifier<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ImportDefaultSpecifier = ({\n\ttype: 'ImportDefaultSpecifier';\n\tlocal: BindingIdentifier;\n}) & Span;"; - impl<'a> Serialize for ImportNamespaceSpecifier<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2127,9 +1732,6 @@ impl<'a> Serialize for ImportNamespaceSpecifier<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ImportNamespaceSpecifier = ({\n\ttype: 'ImportNamespaceSpecifier';\n\tlocal: BindingIdentifier;\n}) & Span;"; - impl<'a> Serialize for WithClause<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2141,9 +1743,6 @@ impl<'a> Serialize for WithClause<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type WithClause = ({\n\ttype: 'WithClause';\n\tattributesKeyword: IdentifierName;\n\twithEntries: Array;\n}) & Span;"; - impl<'a> Serialize for ImportAttribute<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2155,9 +1754,6 @@ impl<'a> Serialize for ImportAttribute<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ImportAttribute = ({\n\ttype: 'ImportAttribute';\n\tkey: ImportAttributeKey;\n\tvalue: StringLiteral;\n}) & Span;"; - impl<'a> Serialize for ImportAttributeKey<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -2167,10 +1763,6 @@ impl<'a> Serialize for ImportAttributeKey<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type ImportAttributeKey = IdentifierName | StringLiteral;"; - impl<'a> Serialize for ExportNamedDeclaration<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2185,9 +1777,6 @@ impl<'a> Serialize for ExportNamedDeclaration<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ExportNamedDeclaration = ({\n\ttype: 'ExportNamedDeclaration';\n\tdeclaration: (Declaration) | null;\n\tspecifiers: Array;\n\tsource: (StringLiteral) | null;\n\texportKind: ImportOrExportKind;\n\twithClause: (WithClause) | null;\n}) & Span;"; - impl<'a> Serialize for ExportDefaultDeclaration<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2199,9 +1788,6 @@ impl<'a> Serialize for ExportDefaultDeclaration<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ExportDefaultDeclaration = ({\n\ttype: 'ExportDefaultDeclaration';\n\tdeclaration: ExportDefaultDeclarationKind;\n\texported: ModuleExportName;\n}) & Span;"; - impl<'a> Serialize for ExportAllDeclaration<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2215,9 +1801,6 @@ impl<'a> Serialize for ExportAllDeclaration<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ExportAllDeclaration = ({\n\ttype: 'ExportAllDeclaration';\n\texported: (ModuleExportName) | null;\n\tsource: StringLiteral;\n\twithClause: (WithClause) | null;\n\texportKind: ImportOrExportKind;\n}) & Span;"; - impl<'a> Serialize for ExportSpecifier<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2230,9 +1813,6 @@ impl<'a> Serialize for ExportSpecifier<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ExportSpecifier = ({\n\ttype: 'ExportSpecifier';\n\tlocal: ModuleExportName;\n\texported: ModuleExportName;\n\texportKind: ImportOrExportKind;\n}) & Span;"; - impl<'a> Serialize for ExportDefaultDeclarationKind<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -2329,9 +1909,6 @@ impl<'a> Serialize for ExportDefaultDeclarationKind<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ExportDefaultDeclarationKind = Function | Class | TSInterfaceDeclaration | BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | StringLiteral | TemplateLiteral | IdentifierReference | MetaProperty | Super | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | Class | ConditionalExpression | Function | ImportExpression | LogicalExpression | NewExpression | ObjectExpression | ParenthesizedExpression | SequenceExpression | TaggedTemplateExpression | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | PrivateInExpression | JSXElement | JSXFragment | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression | TSInstantiationExpression | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression;"; - impl<'a> Serialize for ModuleExportName<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -2342,10 +1919,6 @@ impl<'a> Serialize for ModuleExportName<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type ModuleExportName = IdentifierName | IdentifierReference | StringLiteral;"; - impl<'a> Serialize for TSThisParameter<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2357,9 +1930,6 @@ impl<'a> Serialize for TSThisParameter<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSThisParameter = ({\n\ttype: 'TSThisParameter';\n\tthisSpan: Span;\n\ttypeAnnotation: (TSTypeAnnotation) | null;\n}) & Span;"; - impl<'a> Serialize for TSEnumDeclaration<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2373,9 +1943,6 @@ impl<'a> Serialize for TSEnumDeclaration<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSEnumDeclaration = ({\n\ttype: 'TSEnumDeclaration';\n\tid: BindingIdentifier;\n\tmembers: Array;\n\tconst: boolean;\n\tdeclare: boolean;\n}) & Span;"; - impl<'a> Serialize for TSEnumMember<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2387,9 +1954,6 @@ impl<'a> Serialize for TSEnumMember<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSEnumMember = ({\n\ttype: 'TSEnumMember';\n\tid: TSEnumMemberName;\n\tinitializer: (Expression) | null;\n}) & Span;"; - impl<'a> Serialize for TSEnumMemberName<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -2443,9 +2007,6 @@ impl<'a> Serialize for TSEnumMemberName<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSEnumMemberName = IdentifierName | StringLiteral | TemplateLiteral | NumericLiteral | BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | StringLiteral | TemplateLiteral | IdentifierReference | MetaProperty | Super | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | Class | ConditionalExpression | Function | ImportExpression | LogicalExpression | NewExpression | ObjectExpression | ParenthesizedExpression | SequenceExpression | TaggedTemplateExpression | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | PrivateInExpression | JSXElement | JSXFragment | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression | TSInstantiationExpression | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression;"; - impl<'a> Serialize for TSTypeAnnotation<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2456,9 +2017,6 @@ impl<'a> Serialize for TSTypeAnnotation<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSTypeAnnotation = ({\n\ttype: 'TSTypeAnnotation';\n\ttypeAnnotation: TSType;\n}) & Span;"; - impl<'a> Serialize for TSLiteralType<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2469,10 +2027,6 @@ impl<'a> Serialize for TSLiteralType<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSLiteralType = ({\n\ttype: 'TSLiteralType';\n\tliteral: TSLiteral;\n}) & Span;"; - impl<'a> Serialize for TSLiteral<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -2488,9 +2042,6 @@ impl<'a> Serialize for TSLiteral<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSLiteral = BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | StringLiteral | TemplateLiteral | UnaryExpression;"; - impl<'a> Serialize for TSType<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -2536,9 +2087,6 @@ impl<'a> Serialize for TSType<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSType = TSAnyKeyword | TSBigIntKeyword | TSBooleanKeyword | TSIntrinsicKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSArrayType | TSConditionalType | TSConstructorType | TSFunctionType | TSImportType | TSIndexedAccessType | TSInferType | TSIntersectionType | TSLiteralType | TSMappedType | TSNamedTupleMember | TSQualifiedName | TSTemplateLiteralType | TSThisType | TSTupleType | TSTypeLiteral | TSTypeOperator | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUnionType | TSParenthesizedType | JSDocNullableType | JSDocNonNullableType | JSDocUnknownType;"; - impl<'a> Serialize for TSConditionalType<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2552,9 +2100,6 @@ impl<'a> Serialize for TSConditionalType<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSConditionalType = ({\n\ttype: 'TSConditionalType';\n\tcheckType: TSType;\n\textendsType: TSType;\n\ttrueType: TSType;\n\tfalseType: TSType;\n}) & Span;"; - impl<'a> Serialize for TSUnionType<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2565,10 +2110,6 @@ impl<'a> Serialize for TSUnionType<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSUnionType = ({\n\ttype: 'TSUnionType';\n\ttypes: Array;\n}) & Span;"; - impl<'a> Serialize for TSIntersectionType<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2579,9 +2120,6 @@ impl<'a> Serialize for TSIntersectionType<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSIntersectionType = ({\n\ttype: 'TSIntersectionType';\n\ttypes: Array;\n}) & Span;"; - impl<'a> Serialize for TSParenthesizedType<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2592,9 +2130,6 @@ impl<'a> Serialize for TSParenthesizedType<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSParenthesizedType = ({\n\ttype: 'TSParenthesizedType';\n\ttypeAnnotation: TSType;\n}) & Span;"; - impl<'a> Serialize for TSTypeOperator<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2606,9 +2141,6 @@ impl<'a> Serialize for TSTypeOperator<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSTypeOperator = ({\n\ttype: 'TSTypeOperator';\n\toperator: TSTypeOperatorOperator;\n\ttypeAnnotation: TSType;\n}) & Span;"; - impl Serialize for TSTypeOperatorOperator { fn serialize(&self, serializer: S) -> Result { match *self { @@ -2625,10 +2157,6 @@ impl Serialize for TSTypeOperatorOperator { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSTypeOperatorOperator = 'keyof' | 'unique' | 'readonly';"; - impl<'a> Serialize for TSArrayType<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2639,10 +2167,6 @@ impl<'a> Serialize for TSArrayType<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSArrayType = ({\n\ttype: 'TSArrayType';\n\telementType: TSType;\n}) & Span;"; - impl<'a> Serialize for TSIndexedAccessType<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2654,9 +2178,6 @@ impl<'a> Serialize for TSIndexedAccessType<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSIndexedAccessType = ({\n\ttype: 'TSIndexedAccessType';\n\tobjectType: TSType;\n\tindexType: TSType;\n}) & Span;"; - impl<'a> Serialize for TSTupleType<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2667,9 +2188,6 @@ impl<'a> Serialize for TSTupleType<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSTupleType = ({\n\ttype: 'TSTupleType';\n\telementTypes: Array;\n}) & Span;"; - impl<'a> Serialize for TSNamedTupleMember<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2682,9 +2200,6 @@ impl<'a> Serialize for TSNamedTupleMember<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSNamedTupleMember = ({\n\ttype: 'TSNamedTupleMember';\n\telementType: TSTupleElement;\n\tlabel: IdentifierName;\n\toptional: boolean;\n}) & Span;"; - impl<'a> Serialize for TSOptionalType<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2695,9 +2210,6 @@ impl<'a> Serialize for TSOptionalType<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSOptionalType = ({\n\ttype: 'TSOptionalType';\n\ttypeAnnotation: TSType;\n}) & Span;"; - impl<'a> Serialize for TSRestType<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2708,10 +2220,6 @@ impl<'a> Serialize for TSRestType<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSRestType = ({\n\ttype: 'TSRestType';\n\ttypeAnnotation: TSType;\n}) & Span;"; - impl<'a> Serialize for TSTupleElement<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -2759,9 +2267,6 @@ impl<'a> Serialize for TSTupleElement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSTupleElement = TSOptionalType | TSRestType | TSAnyKeyword | TSBigIntKeyword | TSBooleanKeyword | TSIntrinsicKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSArrayType | TSConditionalType | TSConstructorType | TSFunctionType | TSImportType | TSIndexedAccessType | TSInferType | TSIntersectionType | TSLiteralType | TSMappedType | TSNamedTupleMember | TSQualifiedName | TSTemplateLiteralType | TSThisType | TSTupleType | TSTypeLiteral | TSTypeOperator | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUnionType | TSParenthesizedType | JSDocNullableType | JSDocNonNullableType | JSDocUnknownType;"; - impl Serialize for TSAnyKeyword { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2771,10 +2276,6 @@ impl Serialize for TSAnyKeyword { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSAnyKeyword = ({\n\ttype: 'TSAnyKeyword';\n}) & Span;"; - impl Serialize for TSStringKeyword { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2784,10 +2285,6 @@ impl Serialize for TSStringKeyword { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSStringKeyword = ({\n\ttype: 'TSStringKeyword';\n}) & Span;"; - impl Serialize for TSBooleanKeyword { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2797,10 +2294,6 @@ impl Serialize for TSBooleanKeyword { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSBooleanKeyword = ({\n\ttype: 'TSBooleanKeyword';\n}) & Span;"; - impl Serialize for TSNumberKeyword { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2810,10 +2303,6 @@ impl Serialize for TSNumberKeyword { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSNumberKeyword = ({\n\ttype: 'TSNumberKeyword';\n}) & Span;"; - impl Serialize for TSNeverKeyword { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2823,10 +2312,6 @@ impl Serialize for TSNeverKeyword { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSNeverKeyword = ({\n\ttype: 'TSNeverKeyword';\n}) & Span;"; - impl Serialize for TSIntrinsicKeyword { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2836,10 +2321,6 @@ impl Serialize for TSIntrinsicKeyword { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSIntrinsicKeyword = ({\n\ttype: 'TSIntrinsicKeyword';\n}) & Span;"; - impl Serialize for TSUnknownKeyword { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2849,10 +2330,6 @@ impl Serialize for TSUnknownKeyword { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSUnknownKeyword = ({\n\ttype: 'TSUnknownKeyword';\n}) & Span;"; - impl Serialize for TSNullKeyword { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2862,10 +2339,6 @@ impl Serialize for TSNullKeyword { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSNullKeyword = ({\n\ttype: 'TSNullKeyword';\n}) & Span;"; - impl Serialize for TSUndefinedKeyword { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2875,10 +2348,6 @@ impl Serialize for TSUndefinedKeyword { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSUndefinedKeyword = ({\n\ttype: 'TSUndefinedKeyword';\n}) & Span;"; - impl Serialize for TSVoidKeyword { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2888,10 +2357,6 @@ impl Serialize for TSVoidKeyword { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSVoidKeyword = ({\n\ttype: 'TSVoidKeyword';\n}) & Span;"; - impl Serialize for TSSymbolKeyword { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2901,10 +2366,6 @@ impl Serialize for TSSymbolKeyword { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSSymbolKeyword = ({\n\ttype: 'TSSymbolKeyword';\n}) & Span;"; - impl Serialize for TSThisType { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2914,10 +2375,6 @@ impl Serialize for TSThisType { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSThisType = ({\n\ttype: 'TSThisType';\n}) & Span;"; - impl Serialize for TSObjectKeyword { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2927,10 +2384,6 @@ impl Serialize for TSObjectKeyword { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSObjectKeyword = ({\n\ttype: 'TSObjectKeyword';\n}) & Span;"; - impl Serialize for TSBigIntKeyword { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2940,10 +2393,6 @@ impl Serialize for TSBigIntKeyword { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSBigIntKeyword = ({\n\ttype: 'TSBigIntKeyword';\n}) & Span;"; - impl<'a> Serialize for TSTypeReference<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2955,9 +2404,6 @@ impl<'a> Serialize for TSTypeReference<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSTypeReference = ({\n\ttype: 'TSTypeReference';\n\ttypeName: TSTypeName;\n\ttypeParameters: (TSTypeParameterInstantiation) | null;\n}) & Span;"; - impl<'a> Serialize for TSTypeName<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -2967,10 +2413,6 @@ impl<'a> Serialize for TSTypeName<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSTypeName = IdentifierReference | TSQualifiedName;"; - impl<'a> Serialize for TSQualifiedName<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2982,9 +2424,6 @@ impl<'a> Serialize for TSQualifiedName<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSQualifiedName = ({\n\ttype: 'TSQualifiedName';\n\tleft: TSTypeName;\n\tright: IdentifierName;\n}) & Span;"; - impl<'a> Serialize for TSTypeParameterInstantiation<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -2995,9 +2434,6 @@ impl<'a> Serialize for TSTypeParameterInstantiation<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSTypeParameterInstantiation = ({\n\ttype: 'TSTypeParameterInstantiation';\n\tparams: Array;\n}) & Span;"; - impl<'a> Serialize for TSTypeParameter<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3013,9 +2449,6 @@ impl<'a> Serialize for TSTypeParameter<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSTypeParameter = ({\n\ttype: 'TSTypeParameter';\n\tname: BindingIdentifier;\n\tconstraint: (TSType) | null;\n\tdefault: (TSType) | null;\n\tin: boolean;\n\tout: boolean;\n\tconst: boolean;\n}) & Span;"; - impl<'a> Serialize for TSTypeParameterDeclaration<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3026,9 +2459,6 @@ impl<'a> Serialize for TSTypeParameterDeclaration<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSTypeParameterDeclaration = ({\n\ttype: 'TSTypeParameterDeclaration';\n\tparams: Array;\n}) & Span;"; - impl<'a> Serialize for TSTypeAliasDeclaration<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3042,9 +2472,6 @@ impl<'a> Serialize for TSTypeAliasDeclaration<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSTypeAliasDeclaration = ({\n\ttype: 'TSTypeAliasDeclaration';\n\tid: BindingIdentifier;\n\ttypeParameters: (TSTypeParameterDeclaration) | null;\n\ttypeAnnotation: TSType;\n\tdeclare: boolean;\n}) & Span;"; - impl Serialize for TSAccessibility { fn serialize(&self, serializer: S) -> Result { match *self { @@ -3061,10 +2488,6 @@ impl Serialize for TSAccessibility { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSAccessibility = 'private' | 'protected' | 'public';"; - impl<'a> Serialize for TSClassImplements<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3076,9 +2499,6 @@ impl<'a> Serialize for TSClassImplements<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSClassImplements = ({\n\ttype: 'TSClassImplements';\n\texpression: TSTypeName;\n\ttypeParameters: (TSTypeParameterInstantiation) | null;\n}) & Span;"; - impl<'a> Serialize for TSInterfaceDeclaration<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3093,9 +2513,6 @@ impl<'a> Serialize for TSInterfaceDeclaration<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSInterfaceDeclaration = ({\n\ttype: 'TSInterfaceDeclaration';\n\tid: BindingIdentifier;\n\textends: (Array) | null;\n\ttypeParameters: (TSTypeParameterDeclaration) | null;\n\tbody: TSInterfaceBody;\n\tdeclare: boolean;\n}) & Span;"; - impl<'a> Serialize for TSInterfaceBody<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3106,9 +2523,6 @@ impl<'a> Serialize for TSInterfaceBody<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSInterfaceBody = ({\n\ttype: 'TSInterfaceBody';\n\tbody: Array;\n}) & Span;"; - impl<'a> Serialize for TSPropertySignature<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3123,9 +2537,6 @@ impl<'a> Serialize for TSPropertySignature<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSPropertySignature = ({\n\ttype: 'TSPropertySignature';\n\tcomputed: boolean;\n\toptional: boolean;\n\treadonly: boolean;\n\tkey: PropertyKey;\n\ttypeAnnotation: (TSTypeAnnotation) | null;\n}) & Span;"; - impl<'a> Serialize for TSSignature<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -3138,9 +2549,6 @@ impl<'a> Serialize for TSSignature<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSSignature = TSIndexSignature | TSPropertySignature | TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSMethodSignature;"; - impl<'a> Serialize for TSIndexSignature<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3153,9 +2561,6 @@ impl<'a> Serialize for TSIndexSignature<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSIndexSignature = ({\n\ttype: 'TSIndexSignature';\n\tparameters: Array;\n\ttypeAnnotation: TSTypeAnnotation;\n\treadonly: boolean;\n}) & Span;"; - impl<'a> Serialize for TSCallSignatureDeclaration<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3169,9 +2574,6 @@ impl<'a> Serialize for TSCallSignatureDeclaration<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSCallSignatureDeclaration = ({\n\ttype: 'TSCallSignatureDeclaration';\n\ttypeParameters: (TSTypeParameterDeclaration) | null;\n\tthisParam: (TSThisParameter) | null;\n\tparams: FormalParameters;\n\treturnType: (TSTypeAnnotation) | null;\n}) & Span;"; - impl Serialize for TSMethodSignatureKind { fn serialize(&self, serializer: S) -> Result { match *self { @@ -3188,10 +2590,6 @@ impl Serialize for TSMethodSignatureKind { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSMethodSignatureKind = 'method' | 'get' | 'set';"; - impl<'a> Serialize for TSMethodSignature<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3209,9 +2607,6 @@ impl<'a> Serialize for TSMethodSignature<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSMethodSignature = ({\n\ttype: 'TSMethodSignature';\n\tkey: PropertyKey;\n\tcomputed: boolean;\n\toptional: boolean;\n\tkind: TSMethodSignatureKind;\n\ttypeParameters: (TSTypeParameterDeclaration) | null;\n\tthisParam: (TSThisParameter) | null;\n\tparams: FormalParameters;\n\treturnType: (TSTypeAnnotation) | null;\n}) & Span;"; - impl<'a> Serialize for TSConstructSignatureDeclaration<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3224,9 +2619,6 @@ impl<'a> Serialize for TSConstructSignatureDeclaration<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSConstructSignatureDeclaration = ({\n\ttype: 'TSConstructSignatureDeclaration';\n\ttypeParameters: (TSTypeParameterDeclaration) | null;\n\tparams: FormalParameters;\n\treturnType: (TSTypeAnnotation) | null;\n}) & Span;"; - impl<'a> Serialize for TSIndexSignatureName<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3238,9 +2630,6 @@ impl<'a> Serialize for TSIndexSignatureName<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSIndexSignatureName = ({\n\ttype: 'Identifier';\n\tname: string;\n\ttypeAnnotation: TSTypeAnnotation;\n}) & Span;"; - impl<'a> Serialize for TSInterfaceHeritage<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3252,9 +2641,6 @@ impl<'a> Serialize for TSInterfaceHeritage<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSInterfaceHeritage = ({\n\ttype: 'TSInterfaceHeritage';\n\texpression: Expression;\n\ttypeParameters: (TSTypeParameterInstantiation) | null;\n}) & Span;"; - impl<'a> Serialize for TSTypePredicate<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3267,9 +2653,6 @@ impl<'a> Serialize for TSTypePredicate<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSTypePredicate = ({\n\ttype: 'TSTypePredicate';\n\tparameterName: TSTypePredicateName;\n\tasserts: boolean;\n\ttypeAnnotation: (TSTypeAnnotation) | null;\n}) & Span;"; - impl<'a> Serialize for TSTypePredicateName<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -3279,10 +2662,6 @@ impl<'a> Serialize for TSTypePredicateName<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSTypePredicateName = IdentifierName | TSThisType;"; - impl<'a> Serialize for TSModuleDeclaration<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3296,9 +2675,6 @@ impl<'a> Serialize for TSModuleDeclaration<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSModuleDeclaration = ({\n\ttype: 'TSModuleDeclaration';\n\tid: TSModuleDeclarationName;\n\tbody: (TSModuleDeclarationBody) | null;\n\tkind: TSModuleDeclarationKind;\n\tdeclare: boolean;\n}) & Span;"; - impl Serialize for TSModuleDeclarationKind { fn serialize(&self, serializer: S) -> Result { match *self { @@ -3315,10 +2691,6 @@ impl Serialize for TSModuleDeclarationKind { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSModuleDeclarationKind = 'global' | 'module' | 'namespace';"; - impl<'a> Serialize for TSModuleDeclarationName<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -3328,10 +2700,6 @@ impl<'a> Serialize for TSModuleDeclarationName<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSModuleDeclarationName = BindingIdentifier | StringLiteral;"; - impl<'a> Serialize for TSModuleDeclarationBody<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -3341,13 +2709,6 @@ impl<'a> Serialize for TSModuleDeclarationBody<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSModuleDeclarationBody = TSModuleDeclaration | TSModuleBlock;"; - -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSModuleBlock = ({\n\ttype: 'TSModuleBlock';\n\tbody: Array;\n}) & Span;"; - impl<'a> Serialize for TSTypeLiteral<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3358,9 +2719,6 @@ impl<'a> Serialize for TSTypeLiteral<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSTypeLiteral = ({\n\ttype: 'TSTypeLiteral';\n\tmembers: Array;\n}) & Span;"; - impl<'a> Serialize for TSInferType<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3371,9 +2729,6 @@ impl<'a> Serialize for TSInferType<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSInferType = ({\n\ttype: 'TSInferType';\n\ttypeParameter: TSTypeParameter;\n}) & Span;"; - impl<'a> Serialize for TSTypeQuery<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3385,9 +2740,6 @@ impl<'a> Serialize for TSTypeQuery<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSTypeQuery = ({\n\ttype: 'TSTypeQuery';\n\texprName: TSTypeQueryExprName;\n\ttypeParameters: (TSTypeParameterInstantiation) | null;\n}) & Span;"; - impl<'a> Serialize for TSTypeQueryExprName<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -3398,10 +2750,6 @@ impl<'a> Serialize for TSTypeQueryExprName<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSTypeQueryExprName = TSImportType | IdentifierReference | TSQualifiedName;"; - impl<'a> Serialize for TSImportType<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3416,9 +2764,6 @@ impl<'a> Serialize for TSImportType<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSImportType = ({\n\ttype: 'TSImportType';\n\tisTypeOf: boolean;\n\tparameter: TSType;\n\tqualifier: (TSTypeName) | null;\n\tattributes: (TSImportAttributes) | null;\n\ttypeParameters: (TSTypeParameterInstantiation) | null;\n}) & Span;"; - impl<'a> Serialize for TSImportAttributes<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3430,9 +2775,6 @@ impl<'a> Serialize for TSImportAttributes<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSImportAttributes = ({\n\ttype: 'TSImportAttributes';\n\tattributesKeyword: IdentifierName;\n\telements: Array;\n}) & Span;"; - impl<'a> Serialize for TSImportAttribute<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3444,9 +2786,6 @@ impl<'a> Serialize for TSImportAttribute<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSImportAttribute = ({\n\ttype: 'TSImportAttribute';\n\tname: TSImportAttributeName;\n\tvalue: Expression;\n}) & Span;"; - impl<'a> Serialize for TSImportAttributeName<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -3456,10 +2795,6 @@ impl<'a> Serialize for TSImportAttributeName<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSImportAttributeName = IdentifierName | StringLiteral;"; - impl<'a> Serialize for TSFunctionType<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3473,9 +2808,6 @@ impl<'a> Serialize for TSFunctionType<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSFunctionType = ({\n\ttype: 'TSFunctionType';\n\ttypeParameters: (TSTypeParameterDeclaration) | null;\n\tthisParam: (TSThisParameter) | null;\n\tparams: FormalParameters;\n\treturnType: TSTypeAnnotation;\n}) & Span;"; - impl<'a> Serialize for TSConstructorType<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3489,9 +2821,6 @@ impl<'a> Serialize for TSConstructorType<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSConstructorType = ({\n\ttype: 'TSConstructorType';\n\tabstract: boolean;\n\ttypeParameters: (TSTypeParameterDeclaration) | null;\n\tparams: FormalParameters;\n\treturnType: TSTypeAnnotation;\n}) & Span;"; - impl<'a> Serialize for TSMappedType<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3506,9 +2835,6 @@ impl<'a> Serialize for TSMappedType<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSMappedType = ({\n\ttype: 'TSMappedType';\n\ttypeParameter: TSTypeParameter;\n\tnameType: (TSType) | null;\n\ttypeAnnotation: (TSType) | null;\n\toptional: TSMappedTypeModifierOperator;\n\treadonly: TSMappedTypeModifierOperator;\n}) & Span;"; - impl Serialize for TSMappedTypeModifierOperator { fn serialize(&self, serializer: S) -> Result { match *self { @@ -3528,10 +2854,6 @@ impl Serialize for TSMappedTypeModifierOperator { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type TSMappedTypeModifierOperator = 'true' | '+' | '-' | 'none';"; - impl<'a> Serialize for TSTemplateLiteralType<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3543,9 +2865,6 @@ impl<'a> Serialize for TSTemplateLiteralType<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSTemplateLiteralType = ({\n\ttype: 'TSTemplateLiteralType';\n\tquasis: Array;\n\ttypes: Array;\n}) & Span;"; - impl<'a> Serialize for TSAsExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3557,9 +2876,6 @@ impl<'a> Serialize for TSAsExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSAsExpression = ({\n\ttype: 'TSAsExpression';\n\texpression: Expression;\n\ttypeAnnotation: TSType;\n}) & Span;"; - impl<'a> Serialize for TSSatisfiesExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3571,9 +2887,6 @@ impl<'a> Serialize for TSSatisfiesExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSSatisfiesExpression = ({\n\ttype: 'TSSatisfiesExpression';\n\texpression: Expression;\n\ttypeAnnotation: TSType;\n}) & Span;"; - impl<'a> Serialize for TSTypeAssertion<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3585,9 +2898,6 @@ impl<'a> Serialize for TSTypeAssertion<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSTypeAssertion = ({\n\ttype: 'TSTypeAssertion';\n\texpression: Expression;\n\ttypeAnnotation: TSType;\n}) & Span;"; - impl<'a> Serialize for TSImportEqualsDeclaration<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3600,9 +2910,6 @@ impl<'a> Serialize for TSImportEqualsDeclaration<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSImportEqualsDeclaration = ({\n\ttype: 'TSImportEqualsDeclaration';\n\tid: BindingIdentifier;\n\tmoduleReference: TSModuleReference;\n\timportKind: ImportOrExportKind;\n}) & Span;"; - impl<'a> Serialize for TSModuleReference<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -3613,9 +2920,6 @@ impl<'a> Serialize for TSModuleReference<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSModuleReference = TSExternalModuleReference | IdentifierReference | TSQualifiedName;"; - impl<'a> Serialize for TSExternalModuleReference<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3626,9 +2930,6 @@ impl<'a> Serialize for TSExternalModuleReference<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSExternalModuleReference = ({\n\ttype: 'TSExternalModuleReference';\n\texpression: StringLiteral;\n}) & Span;"; - impl<'a> Serialize for TSNonNullExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3639,9 +2940,6 @@ impl<'a> Serialize for TSNonNullExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSNonNullExpression = ({\n\ttype: 'TSNonNullExpression';\n\texpression: Expression;\n}) & Span;"; - impl<'a> Serialize for Decorator<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3652,10 +2950,6 @@ impl<'a> Serialize for Decorator<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type Decorator = ({\n\ttype: 'Decorator';\n\texpression: Expression;\n}) & Span;"; - impl<'a> Serialize for TSExportAssignment<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3666,9 +2960,6 @@ impl<'a> Serialize for TSExportAssignment<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSExportAssignment = ({\n\ttype: 'TSExportAssignment';\n\texpression: Expression;\n}) & Span;"; - impl<'a> Serialize for TSNamespaceExportDeclaration<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3679,9 +2970,6 @@ impl<'a> Serialize for TSNamespaceExportDeclaration<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSNamespaceExportDeclaration = ({\n\ttype: 'TSNamespaceExportDeclaration';\n\tid: IdentifierName;\n}) & Span;"; - impl<'a> Serialize for TSInstantiationExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3693,9 +2981,6 @@ impl<'a> Serialize for TSInstantiationExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type TSInstantiationExpression = ({\n\ttype: 'TSInstantiationExpression';\n\texpression: Expression;\n\ttypeParameters: TSTypeParameterInstantiation;\n}) & Span;"; - impl Serialize for ImportOrExportKind { fn serialize(&self, serializer: S) -> Result { match *self { @@ -3709,9 +2994,6 @@ impl Serialize for ImportOrExportKind { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ImportOrExportKind = 'value' | 'type';"; - impl<'a> Serialize for JSDocNullableType<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3723,9 +3005,6 @@ impl<'a> Serialize for JSDocNullableType<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type JSDocNullableType = ({\n\ttype: 'JSDocNullableType';\n\ttypeAnnotation: TSType;\n\tpostfix: boolean;\n}) & Span;"; - impl<'a> Serialize for JSDocNonNullableType<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3737,9 +3016,6 @@ impl<'a> Serialize for JSDocNonNullableType<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type JSDocNonNullableType = ({\n\ttype: 'JSDocNonNullableType';\n\ttypeAnnotation: TSType;\n\tpostfix: boolean;\n}) & Span;"; - impl Serialize for JSDocUnknownType { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3749,10 +3025,6 @@ impl Serialize for JSDocUnknownType { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type JSDocUnknownType = ({\n\ttype: 'JSDocUnknownType';\n}) & Span;"; - impl<'a> Serialize for JSXElement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3765,9 +3037,6 @@ impl<'a> Serialize for JSXElement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type JSXElement = ({\n\ttype: 'JSXElement';\n\topeningElement: JSXOpeningElement;\n\tclosingElement: (JSXClosingElement) | null;\n\tchildren: Array;\n}) & Span;"; - impl<'a> Serialize for JSXOpeningElement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3781,9 +3050,6 @@ impl<'a> Serialize for JSXOpeningElement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type JSXOpeningElement = ({\n\ttype: 'JSXOpeningElement';\n\tselfClosing: boolean;\n\tname: JSXElementName;\n\tattributes: Array;\n\ttypeParameters: (TSTypeParameterInstantiation) | null;\n}) & Span;"; - impl<'a> Serialize for JSXClosingElement<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3794,9 +3060,6 @@ impl<'a> Serialize for JSXClosingElement<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type JSXClosingElement = ({\n\ttype: 'JSXClosingElement';\n\tname: JSXElementName;\n}) & Span;"; - impl<'a> Serialize for JSXFragment<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3809,9 +3072,6 @@ impl<'a> Serialize for JSXFragment<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type JSXFragment = ({\n\ttype: 'JSXFragment';\n\topeningFragment: JSXOpeningFragment;\n\tclosingFragment: JSXClosingFragment;\n\tchildren: Array;\n}) & Span;"; - impl Serialize for JSXOpeningFragment { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3821,10 +3081,6 @@ impl Serialize for JSXOpeningFragment { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type JSXOpeningFragment = ({\n\ttype: 'JSXOpeningFragment';\n}) & Span;"; - impl Serialize for JSXClosingFragment { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3834,10 +3090,6 @@ impl Serialize for JSXClosingFragment { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type JSXClosingFragment = ({\n\ttype: 'JSXClosingFragment';\n}) & Span;"; - impl<'a> Serialize for JSXNamespacedName<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3849,9 +3101,6 @@ impl<'a> Serialize for JSXNamespacedName<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type JSXNamespacedName = ({\n\ttype: 'JSXNamespacedName';\n\tnamespace: JSXIdentifier;\n\tproperty: JSXIdentifier;\n}) & Span;"; - impl<'a> Serialize for JSXMemberExpression<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3863,9 +3112,6 @@ impl<'a> Serialize for JSXMemberExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type JSXMemberExpression = ({\n\ttype: 'JSXMemberExpression';\n\tobject: JSXMemberExpressionObject;\n\tproperty: JSXIdentifier;\n}) & Span;"; - impl<'a> Serialize for JSXExpressionContainer<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3876,9 +3122,6 @@ impl<'a> Serialize for JSXExpressionContainer<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type JSXExpressionContainer = ({\n\ttype: 'JSXExpressionContainer';\n\texpression: JSXExpression;\n}) & Span;"; - impl<'a> Serialize for JSXExpression<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -3929,9 +3172,6 @@ impl<'a> Serialize for JSXExpression<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type JSXExpression = JSXEmptyExpression | BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | StringLiteral | TemplateLiteral | IdentifierReference | MetaProperty | Super | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | Class | ConditionalExpression | Function | ImportExpression | LogicalExpression | NewExpression | ObjectExpression | ParenthesizedExpression | SequenceExpression | TaggedTemplateExpression | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | PrivateInExpression | JSXElement | JSXFragment | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression | TSInstantiationExpression | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression;"; - impl Serialize for JSXEmptyExpression { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3941,10 +3181,6 @@ impl Serialize for JSXEmptyExpression { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type JSXEmptyExpression = ({\n\ttype: 'JSXEmptyExpression';\n}) & Span;"; - impl<'a> Serialize for JSXAttributeItem<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -3954,10 +3190,6 @@ impl<'a> Serialize for JSXAttributeItem<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type JSXAttributeItem = JSXAttribute | JSXSpreadAttribute;"; - impl<'a> Serialize for JSXAttribute<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3969,9 +3201,6 @@ impl<'a> Serialize for JSXAttribute<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type JSXAttribute = ({\n\ttype: 'JSXAttribute';\n\tname: JSXAttributeName;\n\tvalue: (JSXAttributeValue) | null;\n}) & Span;"; - impl<'a> Serialize for JSXSpreadAttribute<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -3982,9 +3211,6 @@ impl<'a> Serialize for JSXSpreadAttribute<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type JSXSpreadAttribute = ({\n\ttype: 'JSXSpreadAttribute';\n\targument: Expression;\n}) & Span;"; - impl<'a> Serialize for JSXAttributeName<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -3994,10 +3220,6 @@ impl<'a> Serialize for JSXAttributeName<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type JSXAttributeName = JSXIdentifier | JSXNamespacedName;"; - impl<'a> Serialize for JSXAttributeValue<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -4009,9 +3231,6 @@ impl<'a> Serialize for JSXAttributeValue<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type JSXAttributeValue = StringLiteral | JSXExpressionContainer | JSXElement | JSXFragment;"; - impl<'a> Serialize for JSXIdentifier<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -4022,10 +3241,6 @@ impl<'a> Serialize for JSXIdentifier<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type JSXIdentifier = ({\n\ttype: 'JSXIdentifier';\n\tname: string;\n}) & Span;"; - impl<'a> Serialize for JSXChild<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -4038,9 +3253,6 @@ impl<'a> Serialize for JSXChild<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type JSXChild = JSXText | JSXElement | JSXFragment | JSXExpressionContainer | JSXSpreadChild;"; - impl<'a> Serialize for JSXSpreadChild<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -4051,9 +3263,6 @@ impl<'a> Serialize for JSXSpreadChild<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type JSXSpreadChild = ({\n\ttype: 'JSXSpreadChild';\n\texpression: Expression;\n}) & Span;"; - impl<'a> Serialize for JSXText<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -4063,7 +3272,3 @@ impl<'a> Serialize for JSXText<'a> { map.end() } } - -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type JSXText = ({\n\ttype: 'JSXText';\n\tvalue: string;\n}) & Span;"; diff --git a/crates/oxc_ast/src/serialize.rs b/crates/oxc_ast/src/serialize.rs index 257c9a2936aac..12b3b4fcfa8f3 100644 --- a/crates/oxc_ast/src/serialize.rs +++ b/crates/oxc_ast/src/serialize.rs @@ -156,17 +156,6 @@ impl<'a> Serialize for FormalParameters<'a> { } } -#[cfg(feature = "serialize")] -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = r#" -export type FormalParameterRest = ({ - type: "RestElement", - argument: BindingPatternKind, - typeAnnotation: TSTypeAnnotation | null, - optional: boolean, -}) & Span; -"#; - #[derive(Serialize)] #[serde(tag = "type", rename = "FormalParameters")] struct SerFormalParameters<'a, 'b> { diff --git a/crates/oxc_regular_expression/Cargo.toml b/crates/oxc_regular_expression/Cargo.toml index da2a6720ebb23..7ee49dc2dfa04 100644 --- a/crates/oxc_regular_expression/Cargo.toml +++ b/crates/oxc_regular_expression/Cargo.toml @@ -31,8 +31,7 @@ rustc-hash = { workspace = true } unicode-id-start = { workspace = true } serde = { workspace = true, optional = true } -wasm-bindgen = { workspace = true, optional = true } [features] default = [] -serialize = ["dep:serde", "dep:wasm-bindgen", "oxc_allocator/serialize", "oxc_span/serialize"] +serialize = ["dep:serde", "oxc_allocator/serialize", "oxc_span/serialize"] diff --git a/crates/oxc_regular_expression/src/generated/derive_estree.rs b/crates/oxc_regular_expression/src/generated/derive_estree.rs index 3e744dc59b825..4303e708af996 100644 --- a/crates/oxc_regular_expression/src/generated/derive_estree.rs +++ b/crates/oxc_regular_expression/src/generated/derive_estree.rs @@ -18,10 +18,6 @@ impl<'a> Serialize for Pattern<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type Pattern = ({\n\ttype: 'Pattern';\n\tbody: Disjunction;\n}) & Span;"; - impl<'a> Serialize for Disjunction<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -32,10 +28,6 @@ impl<'a> Serialize for Disjunction<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type Disjunction = ({\n\ttype: 'Disjunction';\n\tbody: Array;\n}) & Span;"; - impl<'a> Serialize for Alternative<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -46,10 +38,6 @@ impl<'a> Serialize for Alternative<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type Alternative = ({\n\ttype: 'Alternative';\n\tbody: Array;\n}) & Span;"; - impl<'a> Serialize for Term<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -69,9 +57,6 @@ impl<'a> Serialize for Term<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type Term = BoundaryAssertion | LookAroundAssertion | Quantifier | Character | Dot | CharacterClassEscape | UnicodePropertyEscape | CharacterClass | CapturingGroup | IgnoreGroup | IndexedReference | NamedReference;"; - impl Serialize for BoundaryAssertion { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -82,9 +67,6 @@ impl Serialize for BoundaryAssertion { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type BoundaryAssertion = ({\n\ttype: 'BoundaryAssertion';\n\tspan: Span;\n\tkind: BoundaryAssertionKind;\n});"; - impl Serialize for BoundaryAssertionKind { fn serialize(&self, serializer: S) -> Result { match *self { @@ -104,10 +86,6 @@ impl Serialize for BoundaryAssertionKind { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type BoundaryAssertionKind = 'start' | 'end' | 'boundary' | 'negativeBoundary';"; - impl<'a> Serialize for LookAroundAssertion<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -119,9 +97,6 @@ impl<'a> Serialize for LookAroundAssertion<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type LookAroundAssertion = ({\n\ttype: 'LookAroundAssertion';\n\tkind: LookAroundAssertionKind;\n\tbody: Disjunction;\n}) & Span;"; - impl Serialize for LookAroundAssertionKind { fn serialize(&self, serializer: S) -> Result { match *self { @@ -145,9 +120,6 @@ impl Serialize for LookAroundAssertionKind { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type LookAroundAssertionKind = 'lookahead' | 'negativeLookahead' | 'lookbehind' | 'negativeLookbehind';"; - impl<'a> Serialize for Quantifier<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -161,9 +133,6 @@ impl<'a> Serialize for Quantifier<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type Quantifier = ({\n\ttype: 'Quantifier';\n\tmin: number;\n\tmax: (number) | null;\n\tgreedy: boolean;\n\tbody: Term;\n}) & Span;"; - impl Serialize for Character { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -175,9 +144,6 @@ impl Serialize for Character { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type Character = ({\n\ttype: 'Character';\n\tkind: CharacterKind;\n\tvalue: number;\n}) & Span;"; - impl Serialize for CharacterKind { fn serialize(&self, serializer: S) -> Result { match *self { @@ -213,9 +179,6 @@ impl Serialize for CharacterKind { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type CharacterKind = 'controlLetter' | 'hexadecimalEscape' | 'identifier' | 'null' | 'octal1' | 'octal2' | 'octal3' | 'singleEscape' | 'symbol' | 'unicodeEscape';"; - impl Serialize for CharacterClassEscape { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -226,9 +189,6 @@ impl Serialize for CharacterClassEscape { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type CharacterClassEscape = ({\n\ttype: 'CharacterClassEscape';\n\tkind: CharacterClassEscapeKind;\n}) & Span;"; - impl Serialize for CharacterClassEscapeKind { fn serialize(&self, serializer: S) -> Result { match *self { @@ -254,9 +214,6 @@ impl Serialize for CharacterClassEscapeKind { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type CharacterClassEscapeKind = 'd' | 'negativeD' | 's' | 'negativeS' | 'w' | 'negativeW';"; - impl<'a> Serialize for UnicodePropertyEscape<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -270,9 +227,6 @@ impl<'a> Serialize for UnicodePropertyEscape<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type UnicodePropertyEscape = ({\n\ttype: 'UnicodePropertyEscape';\n\tnegative: boolean;\n\tstrings: boolean;\n\tname: string;\n\tvalue: (string) | null;\n}) & Span;"; - impl Serialize for Dot { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -282,9 +236,6 @@ impl Serialize for Dot { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type Dot = ({\n\ttype: 'Dot';\n}) & Span;"; - impl<'a> Serialize for CharacterClass<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -298,9 +249,6 @@ impl<'a> Serialize for CharacterClass<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type CharacterClass = ({\n\ttype: 'CharacterClass';\n\tnegative: boolean;\n\tstrings: boolean;\n\tkind: CharacterClassContentsKind;\n\tbody: Array;\n}) & Span;"; - impl Serialize for CharacterClassContentsKind { fn serialize(&self, serializer: S) -> Result { match *self { @@ -319,10 +267,6 @@ impl Serialize for CharacterClassContentsKind { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type CharacterClassContentsKind = 'union' | 'intersection' | 'subtraction';"; - impl<'a> Serialize for CharacterClassContents<'a> { fn serialize(&self, serializer: S) -> Result { match self { @@ -338,9 +282,6 @@ impl<'a> Serialize for CharacterClassContents<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type CharacterClassContents = CharacterClassRange | CharacterClassEscape | UnicodePropertyEscape | Character | CharacterClass | ClassStringDisjunction;"; - impl Serialize for CharacterClassRange { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -352,9 +293,6 @@ impl Serialize for CharacterClassRange { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type CharacterClassRange = ({\n\ttype: 'CharacterClassRange';\n\tmin: Character;\n\tmax: Character;\n}) & Span;"; - impl<'a> Serialize for ClassStringDisjunction<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -366,9 +304,6 @@ impl<'a> Serialize for ClassStringDisjunction<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ClassStringDisjunction = ({\n\ttype: 'ClassStringDisjunction';\n\tstrings: boolean;\n\tbody: Array;\n}) & Span;"; - impl<'a> Serialize for ClassString<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -380,9 +315,6 @@ impl<'a> Serialize for ClassString<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type ClassString = ({\n\ttype: 'ClassString';\n\tstrings: boolean;\n\tbody: Array;\n}) & Span;"; - impl<'a> Serialize for CapturingGroup<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -394,9 +326,6 @@ impl<'a> Serialize for CapturingGroup<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type CapturingGroup = ({\n\ttype: 'CapturingGroup';\n\tname: (string) | null;\n\tbody: Disjunction;\n}) & Span;"; - impl<'a> Serialize for IgnoreGroup<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -408,9 +337,6 @@ impl<'a> Serialize for IgnoreGroup<'a> { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type IgnoreGroup = ({\n\ttype: 'IgnoreGroup';\n\tmodifiers: (Modifiers) | null;\n\tbody: Disjunction;\n}) & Span;"; - impl Serialize for Modifiers { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -422,9 +348,6 @@ impl Serialize for Modifiers { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type Modifiers = ({\n\ttype: 'Modifiers';\n\tenabling: (Modifier) | null;\n\tdisabling: (Modifier) | null;\n}) & Span;"; - impl Serialize for Modifier { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -436,9 +359,6 @@ impl Serialize for Modifier { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type Modifier = ({\n\ttype: 'Modifier';\n\tignoreCase: boolean;\n\tmultiline: boolean;\n\tsticky: boolean;\n});"; - impl Serialize for IndexedReference { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -449,10 +369,6 @@ impl Serialize for IndexedReference { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type IndexedReference = ({\n\ttype: 'IndexedReference';\n\tindex: number;\n}) & Span;"; - impl<'a> Serialize for NamedReference<'a> { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -462,7 +378,3 @@ impl<'a> Serialize for NamedReference<'a> { map.end() } } - -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type NamedReference = ({\n\ttype: 'NamedReference';\n\tname: string;\n}) & Span;"; diff --git a/crates/oxc_span/Cargo.toml b/crates/oxc_span/Cargo.toml index c095b2e678292..c738b86eca1c5 100644 --- a/crates/oxc_span/Cargo.toml +++ b/crates/oxc_span/Cargo.toml @@ -29,9 +29,8 @@ miette = { workspace = true } schemars = { workspace = true, optional = true } serde = { workspace = true, features = ["derive"], optional = true } -wasm-bindgen = { workspace = true, optional = true } [features] default = [] -serialize = ["compact_str/serde", "dep:serde", "dep:wasm-bindgen"] +serialize = ["compact_str/serde", "dep:serde"] schemars = ["dep:schemars"] diff --git a/crates/oxc_span/src/generated/derive_estree.rs b/crates/oxc_span/src/generated/derive_estree.rs index 0350cbbfcdbf7..9009da579fb76 100644 --- a/crates/oxc_span/src/generated/derive_estree.rs +++ b/crates/oxc_span/src/generated/derive_estree.rs @@ -20,10 +20,6 @@ impl Serialize for Span { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type Span = ({\n\tstart: number;\n\tend: number;\n});"; - impl Serialize for SourceType { fn serialize(&self, serializer: S) -> Result { let mut map = serializer.serialize_map(None)?; @@ -34,9 +30,6 @@ impl Serialize for SourceType { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type SourceType = ({\n\tlanguage: Language;\n\tmoduleKind: ModuleKind;\n\tvariant: LanguageVariant;\n});"; - impl Serialize for Language { fn serialize(&self, serializer: S) -> Result { match *self { @@ -53,10 +46,6 @@ impl Serialize for Language { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type Language = 'javascript' | 'typescript' | 'typescriptDefinition';"; - impl Serialize for ModuleKind { fn serialize(&self, serializer: S) -> Result { match *self { @@ -69,10 +58,6 @@ impl Serialize for ModuleKind { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type ModuleKind = 'script' | 'module' | 'unambiguous';"; - impl Serialize for LanguageVariant { fn serialize(&self, serializer: S) -> Result { match *self { @@ -85,6 +70,3 @@ impl Serialize for LanguageVariant { } } } - -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type LanguageVariant = 'standard' | 'jsx';"; diff --git a/crates/oxc_syntax/src/generated/derive_estree.rs b/crates/oxc_syntax/src/generated/derive_estree.rs index f7c5997d4ecd5..1a21d445d7c3e 100644 --- a/crates/oxc_syntax/src/generated/derive_estree.rs +++ b/crates/oxc_syntax/src/generated/derive_estree.rs @@ -63,9 +63,6 @@ impl Serialize for AssignmentOperator { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type AssignmentOperator = '=' | '+=' | '-=' | '*=' | '/=' | '%=' | '<<=' | '>>=' | '>>>=' | '|=' | '^=' | '&=' | '&&=' | '||=' | '??=' | '**=';"; - impl Serialize for BinaryOperator { fn serialize(&self, serializer: S) -> Result { match *self { @@ -137,9 +134,6 @@ impl Serialize for BinaryOperator { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type BinaryOperator = '==' | '!=' | '===' | '!==' | '<' | '<=' | '>' | '>=' | '<<' | '>>' | '>>>' | '+' | '-' | '*' | '/' | '%' | '|' | '^' | '&' | 'in' | 'instanceof' | '**';"; - impl Serialize for LogicalOperator { fn serialize(&self, serializer: S) -> Result { match *self { @@ -154,9 +148,6 @@ impl Serialize for LogicalOperator { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type LogicalOperator = '||' | '&&' | '??';"; - impl Serialize for UnaryOperator { fn serialize(&self, serializer: S) -> Result { match *self { @@ -183,10 +174,6 @@ impl Serialize for UnaryOperator { } } -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = - "export type UnaryOperator = '-' | '+' | '!' | '~' | 'typeof' | 'void' | 'delete';"; - impl Serialize for UpdateOperator { fn serialize(&self, serializer: S) -> Result { match *self { @@ -199,6 +186,3 @@ impl Serialize for UpdateOperator { } } } - -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_APPEND_CONTENT: &'static str = "export type UpdateOperator = '++' | '--';"; diff --git a/crates/oxc_wasm/package.json b/crates/oxc_wasm/package.json new file mode 100644 index 0000000000000..1df1e71d9a79b --- /dev/null +++ b/crates/oxc_wasm/package.json @@ -0,0 +1,30 @@ +{ + "name": "oxc_wasm", + "type": "module", + "collaborators": [ + "Boshen ", + "Oxc contributors" + ], + "version": "0.0.0", + "license": "MIT", + "files": [ + "oxc_wasm_bg.wasm", + "oxc_wasm.js", + "oxc_wasm.d.ts" + ], + "devDependencies": { + "@oxc/types": "workspace:^" + }, + "main": "oxc_wasm.js", + "types": "oxc_wasm.d.ts", + "sideEffects": [ + "./snippets/*" + ], + "keywords": [ + "JavaScript", + "TypeScript", + "linter", + "minifier", + "parser" + ] +} diff --git a/crates/oxc_wasm/src/lib.rs b/crates/oxc_wasm/src/lib.rs index abea67d29ccfb..e63257ac9af3b 100644 --- a/crates/oxc_wasm/src/lib.rs +++ b/crates/oxc_wasm/src/lib.rs @@ -32,6 +32,12 @@ use wasm_bindgen::prelude::*; use crate::options::{OxcOptions, OxcRunOptions}; +#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] +const TS_APPEND_CONTENT: &'static str = r#" +import type { Program, Span } from "@oxc/types"; +export * from "@oxc/types"; +"#; + #[wasm_bindgen(getter_with_clone)] #[derive(Default, Tsify)] #[serde(rename_all = "camelCase")] diff --git a/justfile b/justfile index bb2e67c3d3da6..6afa562246341 100755 --- a/justfile +++ b/justfile @@ -136,6 +136,7 @@ watch-wasm: build-wasm mode="release": wasm-pack build --out-dir ../../npm/oxc-wasm --target web --{{mode}} --scope oxc crates/oxc_wasm + cp crates/oxc_wasm/package.json npm/oxc-wasm/package.json # Generate the JavaScript global variables. See `tasks/javascript_globals` javascript-globals: diff --git a/npm/oxc-types/README.md b/npm/oxc-types/README.md new file mode 100644 index 0000000000000..d5b248ac3fc1e --- /dev/null +++ b/npm/oxc-types/README.md @@ -0,0 +1,3 @@ +# Oxc Types + +Typescript definitions for Oxc AST nodes. diff --git a/npm/oxc-types/package.json b/npm/oxc-types/package.json new file mode 100644 index 0000000000000..05ca8ba3e1eac --- /dev/null +++ b/npm/oxc-types/package.json @@ -0,0 +1,27 @@ +{ + "name": "@oxc/types", + "version": "0.32.0", + "description": "Types for Oxc AST nodes", + "keywords": [ + "AST", + "Parser" + ], + "author": "Boshen and oxc contributors", + "license": "MIT", + "homepage": "https://oxc.rs", + "bugs": "https://github.com/oxc-project/oxc/issues", + "repository": { + "type": "git", + "url": "https://github.com/oxc-project/oxc.git", + "directory": "npm/oxc-types" + }, + "funding": { + "url": "https://github.com/sponsors/Boshen" + }, + "main": "", + "types": "src/index.d.ts", + "files": [ + "src/index.d.ts", + "src/generated/types.d.ts" + ] +} diff --git a/npm/oxc-types/src/generated/types.d.ts b/npm/oxc-types/src/generated/types.d.ts new file mode 100644 index 0000000000000..22292288e059c --- /dev/null +++ b/npm/oxc-types/src/generated/types.d.ts @@ -0,0 +1,2010 @@ +// To edit this generated file you have to edit `tasks/ast_tools/src/generators/typescript.rs` +// Auto-generated code, DO NOT EDIT DIRECTLY! + +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; +} + +export interface NullLiteral extends Span { + type: 'NullLiteral'; +} + +export interface NumericLiteral extends Span { + type: 'NumericLiteral'; + value: number; + raw: string; +} + +export interface BigIntLiteral extends Span { + type: 'BigIntLiteral'; + raw: string; +} + +export interface RegExpLiteral extends Span { + type: 'RegExpLiteral'; + value: EmptyObject; + regex: RegExp; +} + +export interface RegExp { + pattern: RegExpPattern; + flags: RegExpFlags; +} + +export type RegExpPattern = string | string | Pattern; + +export interface EmptyObject { +} + +export interface StringLiteral extends Span { + type: 'StringLiteral'; + value: string; +} + +export interface Program extends Span { + type: 'Program'; + sourceType: SourceType; + hashbang: (Hashbang) | null; + directives: Array; + body: Array; +} + +export type Expression = + | BooleanLiteral + | NullLiteral + | NumericLiteral + | BigIntLiteral + | RegExpLiteral + | StringLiteral + | TemplateLiteral + | IdentifierReference + | MetaProperty + | Super + | ArrayExpression + | ArrowFunctionExpression + | AssignmentExpression + | AwaitExpression + | BinaryExpression + | CallExpression + | ChainExpression + | Class + | ConditionalExpression + | Function + | ImportExpression + | LogicalExpression + | NewExpression + | ObjectExpression + | ParenthesizedExpression + | SequenceExpression + | TaggedTemplateExpression + | ThisExpression + | UnaryExpression + | UpdateExpression + | YieldExpression + | PrivateInExpression + | JSXElement + | JSXFragment + | TSAsExpression + | TSSatisfiesExpression + | TSTypeAssertion + | TSNonNullExpression + | TSInstantiationExpression + | ComputedMemberExpression + | StaticMemberExpression + | PrivateFieldExpression; + +export interface IdentifierName extends Span { + type: 'Identifier'; + name: string; +} + +export interface IdentifierReference extends Span { + type: 'Identifier'; + name: string; +} + +export interface BindingIdentifier extends Span { + type: 'Identifier'; + name: string; +} + +export interface LabelIdentifier extends Span { + type: 'Identifier'; + name: string; +} + +export interface ThisExpression extends Span { + type: 'ThisExpression'; +} + +export interface ArrayExpression extends Span { + type: 'ArrayExpression'; + elements: Array; +} + +export interface ObjectExpression extends Span { + type: 'ObjectExpression'; + properties: Array; +} + +export type ObjectPropertyKind = ObjectProperty | SpreadElement; + +export interface ObjectProperty extends Span { + type: 'ObjectProperty'; + kind: PropertyKind; + key: PropertyKey; + value: Expression; + init: (Expression) | null; + method: boolean; + shorthand: boolean; + computed: boolean; +} + +export type PropertyKey = + | IdentifierName + | PrivateIdentifier + | BooleanLiteral + | NullLiteral + | NumericLiteral + | BigIntLiteral + | RegExpLiteral + | StringLiteral + | TemplateLiteral + | IdentifierReference + | MetaProperty + | Super + | ArrayExpression + | ArrowFunctionExpression + | AssignmentExpression + | AwaitExpression + | BinaryExpression + | CallExpression + | ChainExpression + | Class + | ConditionalExpression + | Function + | ImportExpression + | LogicalExpression + | NewExpression + | ObjectExpression + | ParenthesizedExpression + | SequenceExpression + | TaggedTemplateExpression + | ThisExpression + | UnaryExpression + | UpdateExpression + | YieldExpression + | PrivateInExpression + | JSXElement + | JSXFragment + | TSAsExpression + | TSSatisfiesExpression + | TSTypeAssertion + | TSNonNullExpression + | TSInstantiationExpression + | ComputedMemberExpression + | StaticMemberExpression + | PrivateFieldExpression; + +export type PropertyKind = 'init' | 'get' | 'set'; + +export interface TemplateLiteral extends Span { + type: 'TemplateLiteral'; + quasis: Array; + expressions: Array; +} + +export interface TaggedTemplateExpression extends Span { + type: 'TaggedTemplateExpression'; + tag: Expression; + quasi: TemplateLiteral; + typeParameters: (TSTypeParameterInstantiation) | null; +} + +export interface TemplateElement extends Span { + type: 'TemplateElement'; + tail: boolean; + value: TemplateElementValue; +} + +export interface TemplateElementValue { + raw: string; + cooked: (string) | null; +} + +export type MemberExpression = ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression; + +export interface ComputedMemberExpression extends Span { + type: 'ComputedMemberExpression'; + object: Expression; + expression: Expression; + optional: boolean; +} + +export interface StaticMemberExpression extends Span { + type: 'StaticMemberExpression'; + object: Expression; + property: IdentifierName; + optional: boolean; +} + +export interface PrivateFieldExpression extends Span { + type: 'PrivateFieldExpression'; + object: Expression; + field: PrivateIdentifier; + optional: boolean; +} + +export interface CallExpression extends Span { + type: 'CallExpression'; + callee: Expression; + typeParameters: (TSTypeParameterInstantiation) | null; + arguments: Array; + optional: boolean; +} + +export interface NewExpression extends Span { + type: 'NewExpression'; + callee: Expression; + arguments: Array; + typeParameters: (TSTypeParameterInstantiation) | null; +} + +export interface MetaProperty extends Span { + type: 'MetaProperty'; + meta: IdentifierName; + property: IdentifierName; +} + +export interface SpreadElement extends Span { + type: 'SpreadElement'; + argument: Expression; +} + +export type Argument = + | SpreadElement + | BooleanLiteral + | NullLiteral + | NumericLiteral + | BigIntLiteral + | RegExpLiteral + | StringLiteral + | TemplateLiteral + | IdentifierReference + | MetaProperty + | Super + | ArrayExpression + | ArrowFunctionExpression + | AssignmentExpression + | AwaitExpression + | BinaryExpression + | CallExpression + | ChainExpression + | Class + | ConditionalExpression + | Function + | ImportExpression + | LogicalExpression + | NewExpression + | ObjectExpression + | ParenthesizedExpression + | SequenceExpression + | TaggedTemplateExpression + | ThisExpression + | UnaryExpression + | UpdateExpression + | YieldExpression + | PrivateInExpression + | JSXElement + | JSXFragment + | TSAsExpression + | TSSatisfiesExpression + | TSTypeAssertion + | TSNonNullExpression + | TSInstantiationExpression + | ComputedMemberExpression + | StaticMemberExpression + | PrivateFieldExpression; + +export interface UpdateExpression extends Span { + type: 'UpdateExpression'; + operator: UpdateOperator; + prefix: boolean; + argument: SimpleAssignmentTarget; +} + +export interface UnaryExpression extends Span { + type: 'UnaryExpression'; + operator: UnaryOperator; + argument: Expression; +} + +export interface BinaryExpression extends Span { + type: 'BinaryExpression'; + left: Expression; + operator: BinaryOperator; + right: Expression; +} + +export interface PrivateInExpression extends Span { + type: 'PrivateInExpression'; + left: PrivateIdentifier; + operator: BinaryOperator; + right: Expression; +} + +export interface LogicalExpression extends Span { + type: 'LogicalExpression'; + left: Expression; + operator: LogicalOperator; + right: Expression; +} + +export interface ConditionalExpression extends Span { + type: 'ConditionalExpression'; + test: Expression; + consequent: Expression; + alternate: Expression; +} + +export interface AssignmentExpression extends Span { + type: 'AssignmentExpression'; + operator: AssignmentOperator; + left: AssignmentTarget; + right: Expression; +} + +export type AssignmentTarget = + | IdentifierReference + | TSAsExpression + | TSSatisfiesExpression + | TSNonNullExpression + | TSTypeAssertion + | TSInstantiationExpression + | ComputedMemberExpression + | StaticMemberExpression + | PrivateFieldExpression + | ArrayAssignmentTarget + | ObjectAssignmentTarget; + +export type SimpleAssignmentTarget = + | IdentifierReference + | TSAsExpression + | TSSatisfiesExpression + | TSNonNullExpression + | TSTypeAssertion + | TSInstantiationExpression + | ComputedMemberExpression + | StaticMemberExpression + | PrivateFieldExpression; + +export type AssignmentTargetPattern = ArrayAssignmentTarget | ObjectAssignmentTarget; + +export interface ArrayAssignmentTarget extends Span { + type: 'ArrayAssignmentTarget'; + elements: Array; +} + +export interface ObjectAssignmentTarget extends Span { + type: 'ObjectAssignmentTarget'; + properties: Array; +} + +export interface AssignmentTargetRest extends Span { + type: 'RestElement'; + argument: AssignmentTarget; +} + +export type AssignmentTargetMaybeDefault = + | AssignmentTargetWithDefault + | IdentifierReference + | TSAsExpression + | TSSatisfiesExpression + | TSNonNullExpression + | TSTypeAssertion + | TSInstantiationExpression + | ComputedMemberExpression + | StaticMemberExpression + | PrivateFieldExpression + | ArrayAssignmentTarget + | ObjectAssignmentTarget; + +export interface AssignmentTargetWithDefault extends Span { + type: 'AssignmentTargetWithDefault'; + binding: AssignmentTarget; + init: Expression; +} + +export type AssignmentTargetProperty = AssignmentTargetPropertyIdentifier | AssignmentTargetPropertyProperty; + +export interface AssignmentTargetPropertyIdentifier extends Span { + type: 'AssignmentTargetPropertyIdentifier'; + binding: IdentifierReference; + init: (Expression) | null; +} + +export interface AssignmentTargetPropertyProperty extends Span { + type: 'AssignmentTargetPropertyProperty'; + name: PropertyKey; + binding: AssignmentTargetMaybeDefault; +} + +export interface SequenceExpression extends Span { + type: 'SequenceExpression'; + expressions: Array; +} + +export interface Super extends Span { + type: 'Super'; +} + +export interface AwaitExpression extends Span { + type: 'AwaitExpression'; + argument: Expression; +} + +export interface ChainExpression extends Span { + type: 'ChainExpression'; + expression: ChainElement; +} + +export type ChainElement = CallExpression | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression; + +export interface ParenthesizedExpression extends Span { + type: 'ParenthesizedExpression'; + expression: Expression; +} + +export type Statement = + | BlockStatement + | BreakStatement + | ContinueStatement + | DebuggerStatement + | DoWhileStatement + | EmptyStatement + | ExpressionStatement + | ForInStatement + | ForOfStatement + | ForStatement + | IfStatement + | LabeledStatement + | ReturnStatement + | SwitchStatement + | ThrowStatement + | TryStatement + | WhileStatement + | WithStatement + | VariableDeclaration + | Function + | Class + | TSTypeAliasDeclaration + | TSInterfaceDeclaration + | TSEnumDeclaration + | TSModuleDeclaration + | TSImportEqualsDeclaration + | ImportDeclaration + | ExportAllDeclaration + | ExportDefaultDeclaration + | ExportNamedDeclaration + | TSExportAssignment + | TSNamespaceExportDeclaration; + +export interface Directive extends Span { + type: 'Directive'; + expression: StringLiteral; + directive: string; +} + +export interface Hashbang extends Span { + type: 'Hashbang'; + value: string; +} + +export interface BlockStatement extends Span { + type: 'BlockStatement'; + body: Array; +} + +export type Declaration = + | VariableDeclaration + | Function + | Class + | TSTypeAliasDeclaration + | TSInterfaceDeclaration + | TSEnumDeclaration + | TSModuleDeclaration + | TSImportEqualsDeclaration; + +export interface VariableDeclaration extends Span { + type: 'VariableDeclaration'; + kind: VariableDeclarationKind; + declarations: Array; + declare: boolean; +} + +export type VariableDeclarationKind = 'var' | 'const' | 'let' | 'using' | 'await using'; + +export interface VariableDeclarator extends Span { + type: 'VariableDeclarator'; + id: BindingPattern; + init: (Expression) | null; + definite: boolean; +} + +export interface EmptyStatement extends Span { + type: 'EmptyStatement'; +} + +export interface ExpressionStatement extends Span { + type: 'ExpressionStatement'; + expression: Expression; +} + +export interface IfStatement extends Span { + type: 'IfStatement'; + test: Expression; + consequent: Statement; + alternate: (Statement) | null; +} + +export interface DoWhileStatement extends Span { + type: 'DoWhileStatement'; + body: Statement; + test: Expression; +} + +export interface WhileStatement extends Span { + type: 'WhileStatement'; + test: Expression; + body: Statement; +} + +export interface ForStatement extends Span { + type: 'ForStatement'; + init: (ForStatementInit) | null; + test: (Expression) | null; + update: (Expression) | null; + body: Statement; +} + +export type ForStatementInit = + | VariableDeclaration + | BooleanLiteral + | NullLiteral + | NumericLiteral + | BigIntLiteral + | RegExpLiteral + | StringLiteral + | TemplateLiteral + | IdentifierReference + | MetaProperty + | Super + | ArrayExpression + | ArrowFunctionExpression + | AssignmentExpression + | AwaitExpression + | BinaryExpression + | CallExpression + | ChainExpression + | Class + | ConditionalExpression + | Function + | ImportExpression + | LogicalExpression + | NewExpression + | ObjectExpression + | ParenthesizedExpression + | SequenceExpression + | TaggedTemplateExpression + | ThisExpression + | UnaryExpression + | UpdateExpression + | YieldExpression + | PrivateInExpression + | JSXElement + | JSXFragment + | TSAsExpression + | TSSatisfiesExpression + | TSTypeAssertion + | TSNonNullExpression + | TSInstantiationExpression + | ComputedMemberExpression + | StaticMemberExpression + | PrivateFieldExpression; + +export interface ForInStatement extends Span { + type: 'ForInStatement'; + left: ForStatementLeft; + right: Expression; + body: Statement; +} + +export type ForStatementLeft = + | VariableDeclaration + | IdentifierReference + | TSAsExpression + | TSSatisfiesExpression + | TSNonNullExpression + | TSTypeAssertion + | TSInstantiationExpression + | ComputedMemberExpression + | StaticMemberExpression + | PrivateFieldExpression + | ArrayAssignmentTarget + | ObjectAssignmentTarget; + +export interface ForOfStatement extends Span { + type: 'ForOfStatement'; + await: boolean; + left: ForStatementLeft; + right: Expression; + body: Statement; +} + +export interface ContinueStatement extends Span { + type: 'ContinueStatement'; + label: (LabelIdentifier) | null; +} + +export interface BreakStatement extends Span { + type: 'BreakStatement'; + label: (LabelIdentifier) | null; +} + +export interface ReturnStatement extends Span { + type: 'ReturnStatement'; + argument: (Expression) | null; +} + +export interface WithStatement extends Span { + type: 'WithStatement'; + object: Expression; + body: Statement; +} + +export interface SwitchStatement extends Span { + type: 'SwitchStatement'; + discriminant: Expression; + cases: Array; +} + +export interface SwitchCase extends Span { + type: 'SwitchCase'; + test: (Expression) | null; + consequent: Array; +} + +export interface LabeledStatement extends Span { + type: 'LabeledStatement'; + label: LabelIdentifier; + body: Statement; +} + +export interface ThrowStatement extends Span { + type: 'ThrowStatement'; + argument: Expression; +} + +export interface TryStatement extends Span { + type: 'TryStatement'; + block: BlockStatement; + handler: (CatchClause) | null; + finalizer: (BlockStatement) | null; +} + +export interface CatchClause extends Span { + type: 'CatchClause'; + param: (CatchParameter) | null; + body: BlockStatement; +} + +export interface CatchParameter extends Span { + type: 'CatchParameter'; + pattern: BindingPattern; +} + +export interface DebuggerStatement extends Span { + type: 'DebuggerStatement'; +} + +export type BindingPattern = + & ({ + typeAnnotation: (TSTypeAnnotation) | null; + optional: boolean; + }) + & (BindingIdentifier | ObjectPattern | ArrayPattern | AssignmentPattern); + +export type BindingPatternKind = BindingIdentifier | ObjectPattern | ArrayPattern | AssignmentPattern; + +export interface AssignmentPattern extends Span { + type: 'AssignmentPattern'; + left: BindingPattern; + right: Expression; +} + +export interface ObjectPattern extends Span { + type: 'ObjectPattern'; + properties: Array; +} + +export interface BindingProperty extends Span { + type: 'BindingProperty'; + key: PropertyKey; + value: BindingPattern; + shorthand: boolean; + computed: boolean; +} + +export interface ArrayPattern extends Span { + type: 'ArrayPattern'; + elements: Array; +} + +export interface BindingRestElement extends Span { + type: 'RestElement'; + argument: BindingPattern; +} + +export interface Function extends Span { + type: FunctionType; + id: (BindingIdentifier) | null; + generator: boolean; + async: boolean; + declare: boolean; + typeParameters: (TSTypeParameterDeclaration) | null; + thisParam: (TSThisParameter) | null; + params: FormalParameters; + returnType: (TSTypeAnnotation) | null; + body: (FunctionBody) | null; +} + +export type FunctionType = + | 'FunctionDeclaration' + | 'FunctionExpression' + | 'TSDeclareFunction' + | 'TSEmptyBodyFunctionExpression'; + +export interface FormalParameters extends Span { + type: 'FormalParameters'; + kind: FormalParameterKind; + items: Array; +} + +export interface FormalParameter extends Span { + type: 'FormalParameter'; + decorators: Array; + pattern: BindingPattern; + accessibility: (TSAccessibility) | null; + readonly: boolean; + override: boolean; +} + +export type FormalParameterKind = 'FormalParameter' | 'UniqueFormalParameters' | 'ArrowFormalParameters' | 'Signature'; + +export interface FunctionBody extends Span { + type: 'FunctionBody'; + directives: Array; + statements: Array; +} + +export interface ArrowFunctionExpression extends Span { + type: 'ArrowFunctionExpression'; + expression: boolean; + async: boolean; + typeParameters: (TSTypeParameterDeclaration) | null; + params: FormalParameters; + returnType: (TSTypeAnnotation) | null; + body: FunctionBody; +} + +export interface YieldExpression extends Span { + type: 'YieldExpression'; + delegate: boolean; + argument: (Expression) | null; +} + +export interface Class extends Span { + type: ClassType; + decorators: Array; + id: (BindingIdentifier) | null; + typeParameters: (TSTypeParameterDeclaration) | null; + superClass: (Expression) | null; + superTypeParameters: (TSTypeParameterInstantiation) | null; + implements: (Array) | null; + body: ClassBody; + abstract: boolean; + declare: boolean; +} + +export type ClassType = 'ClassDeclaration' | 'ClassExpression'; + +export interface ClassBody extends Span { + type: 'ClassBody'; + body: Array; +} + +export type ClassElement = StaticBlock | MethodDefinition | PropertyDefinition | AccessorProperty | TSIndexSignature; + +export interface MethodDefinition extends Span { + type: MethodDefinitionType; + decorators: Array; + key: PropertyKey; + value: Function; + kind: MethodDefinitionKind; + computed: boolean; + static: boolean; + override: boolean; + optional: boolean; + accessibility: (TSAccessibility) | null; +} + +export type MethodDefinitionType = 'MethodDefinition' | 'TSAbstractMethodDefinition'; + +export interface PropertyDefinition extends Span { + type: PropertyDefinitionType; + decorators: Array; + key: PropertyKey; + value: (Expression) | null; + computed: boolean; + static: boolean; + declare: boolean; + override: boolean; + optional: boolean; + definite: boolean; + readonly: boolean; + typeAnnotation: (TSTypeAnnotation) | null; + accessibility: (TSAccessibility) | null; +} + +export type PropertyDefinitionType = 'PropertyDefinition' | 'TSAbstractPropertyDefinition'; + +export type MethodDefinitionKind = 'constructor' | 'method' | 'get' | 'set'; + +export interface PrivateIdentifier extends Span { + type: 'PrivateIdentifier'; + name: string; +} + +export interface StaticBlock extends Span { + type: 'StaticBlock'; + body: Array; +} + +export type ModuleDeclaration = + | ImportDeclaration + | ExportAllDeclaration + | ExportDefaultDeclaration + | ExportNamedDeclaration + | TSExportAssignment + | TSNamespaceExportDeclaration; + +export type AccessorPropertyType = 'AccessorProperty' | 'TSAbstractAccessorProperty'; + +export interface AccessorProperty extends Span { + type: AccessorPropertyType; + decorators: Array; + key: PropertyKey; + value: (Expression) | null; + computed: boolean; + static: boolean; + definite: boolean; + typeAnnotation: (TSTypeAnnotation) | null; + accessibility: (TSAccessibility) | null; +} + +export interface ImportExpression extends Span { + type: 'ImportExpression'; + source: Expression; + arguments: Array; +} + +export interface ImportDeclaration extends Span { + type: 'ImportDeclaration'; + specifiers: (Array) | null; + source: StringLiteral; + withClause: (WithClause) | null; + importKind: ImportOrExportKind; +} + +export type ImportDeclarationSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier; + +export interface ImportSpecifier extends Span { + type: 'ImportSpecifier'; + imported: ModuleExportName; + local: BindingIdentifier; + importKind: ImportOrExportKind; +} + +export interface ImportDefaultSpecifier extends Span { + type: 'ImportDefaultSpecifier'; + local: BindingIdentifier; +} + +export interface ImportNamespaceSpecifier extends Span { + type: 'ImportNamespaceSpecifier'; + local: BindingIdentifier; +} + +export interface WithClause extends Span { + type: 'WithClause'; + attributesKeyword: IdentifierName; + withEntries: Array; +} + +export interface ImportAttribute extends Span { + type: 'ImportAttribute'; + key: ImportAttributeKey; + value: StringLiteral; +} + +export type ImportAttributeKey = IdentifierName | StringLiteral; + +export interface ExportNamedDeclaration extends Span { + type: 'ExportNamedDeclaration'; + declaration: (Declaration) | null; + specifiers: Array; + source: (StringLiteral) | null; + exportKind: ImportOrExportKind; + withClause: (WithClause) | null; +} + +export interface ExportDefaultDeclaration extends Span { + type: 'ExportDefaultDeclaration'; + declaration: ExportDefaultDeclarationKind; + exported: ModuleExportName; +} + +export interface ExportAllDeclaration extends Span { + type: 'ExportAllDeclaration'; + exported: (ModuleExportName) | null; + source: StringLiteral; + withClause: (WithClause) | null; + exportKind: ImportOrExportKind; +} + +export interface ExportSpecifier extends Span { + type: 'ExportSpecifier'; + local: ModuleExportName; + exported: ModuleExportName; + exportKind: ImportOrExportKind; +} + +export type ExportDefaultDeclarationKind = + | Function + | Class + | TSInterfaceDeclaration + | BooleanLiteral + | NullLiteral + | NumericLiteral + | BigIntLiteral + | RegExpLiteral + | StringLiteral + | TemplateLiteral + | IdentifierReference + | MetaProperty + | Super + | ArrayExpression + | ArrowFunctionExpression + | AssignmentExpression + | AwaitExpression + | BinaryExpression + | CallExpression + | ChainExpression + | Class + | ConditionalExpression + | Function + | ImportExpression + | LogicalExpression + | NewExpression + | ObjectExpression + | ParenthesizedExpression + | SequenceExpression + | TaggedTemplateExpression + | ThisExpression + | UnaryExpression + | UpdateExpression + | YieldExpression + | PrivateInExpression + | JSXElement + | JSXFragment + | TSAsExpression + | TSSatisfiesExpression + | TSTypeAssertion + | TSNonNullExpression + | TSInstantiationExpression + | ComputedMemberExpression + | StaticMemberExpression + | PrivateFieldExpression; + +export type ModuleExportName = IdentifierName | IdentifierReference | StringLiteral; + +export interface TSThisParameter extends Span { + type: 'TSThisParameter'; + thisSpan: Span; + typeAnnotation: (TSTypeAnnotation) | null; +} + +export interface TSEnumDeclaration extends Span { + type: 'TSEnumDeclaration'; + id: BindingIdentifier; + members: Array; + const: boolean; + declare: boolean; +} + +export interface TSEnumMember extends Span { + type: 'TSEnumMember'; + id: TSEnumMemberName; + initializer: (Expression) | null; +} + +export type TSEnumMemberName = + | IdentifierName + | StringLiteral + | TemplateLiteral + | NumericLiteral + | BooleanLiteral + | NullLiteral + | NumericLiteral + | BigIntLiteral + | RegExpLiteral + | StringLiteral + | TemplateLiteral + | IdentifierReference + | MetaProperty + | Super + | ArrayExpression + | ArrowFunctionExpression + | AssignmentExpression + | AwaitExpression + | BinaryExpression + | CallExpression + | ChainExpression + | Class + | ConditionalExpression + | Function + | ImportExpression + | LogicalExpression + | NewExpression + | ObjectExpression + | ParenthesizedExpression + | SequenceExpression + | TaggedTemplateExpression + | ThisExpression + | UnaryExpression + | UpdateExpression + | YieldExpression + | PrivateInExpression + | JSXElement + | JSXFragment + | TSAsExpression + | TSSatisfiesExpression + | TSTypeAssertion + | TSNonNullExpression + | TSInstantiationExpression + | ComputedMemberExpression + | StaticMemberExpression + | PrivateFieldExpression; + +export interface TSTypeAnnotation extends Span { + type: 'TSTypeAnnotation'; + typeAnnotation: TSType; +} + +export interface TSLiteralType extends Span { + type: 'TSLiteralType'; + literal: TSLiteral; +} + +export type TSLiteral = + | BooleanLiteral + | NullLiteral + | NumericLiteral + | BigIntLiteral + | RegExpLiteral + | StringLiteral + | TemplateLiteral + | UnaryExpression; + +export type TSType = + | TSAnyKeyword + | TSBigIntKeyword + | TSBooleanKeyword + | TSIntrinsicKeyword + | TSNeverKeyword + | TSNullKeyword + | TSNumberKeyword + | TSObjectKeyword + | TSStringKeyword + | TSSymbolKeyword + | TSUndefinedKeyword + | TSUnknownKeyword + | TSVoidKeyword + | TSArrayType + | TSConditionalType + | TSConstructorType + | TSFunctionType + | TSImportType + | TSIndexedAccessType + | TSInferType + | TSIntersectionType + | TSLiteralType + | TSMappedType + | TSNamedTupleMember + | TSQualifiedName + | TSTemplateLiteralType + | TSThisType + | TSTupleType + | TSTypeLiteral + | TSTypeOperator + | TSTypePredicate + | TSTypeQuery + | TSTypeReference + | TSUnionType + | TSParenthesizedType + | JSDocNullableType + | JSDocNonNullableType + | JSDocUnknownType; + +export interface TSConditionalType extends Span { + type: 'TSConditionalType'; + checkType: TSType; + extendsType: TSType; + trueType: TSType; + falseType: TSType; +} + +export interface TSUnionType extends Span { + type: 'TSUnionType'; + types: Array; +} + +export interface TSIntersectionType extends Span { + type: 'TSIntersectionType'; + types: Array; +} + +export interface TSParenthesizedType extends Span { + type: 'TSParenthesizedType'; + typeAnnotation: TSType; +} + +export interface TSTypeOperator extends Span { + type: 'TSTypeOperator'; + operator: TSTypeOperatorOperator; + typeAnnotation: TSType; +} + +export type TSTypeOperatorOperator = 'keyof' | 'unique' | 'readonly'; + +export interface TSArrayType extends Span { + type: 'TSArrayType'; + elementType: TSType; +} + +export interface TSIndexedAccessType extends Span { + type: 'TSIndexedAccessType'; + objectType: TSType; + indexType: TSType; +} + +export interface TSTupleType extends Span { + type: 'TSTupleType'; + elementTypes: Array; +} + +export interface TSNamedTupleMember extends Span { + type: 'TSNamedTupleMember'; + elementType: TSTupleElement; + label: IdentifierName; + optional: boolean; +} + +export interface TSOptionalType extends Span { + type: 'TSOptionalType'; + typeAnnotation: TSType; +} + +export interface TSRestType extends Span { + type: 'TSRestType'; + typeAnnotation: TSType; +} + +export type TSTupleElement = + | TSOptionalType + | TSRestType + | TSAnyKeyword + | TSBigIntKeyword + | TSBooleanKeyword + | TSIntrinsicKeyword + | TSNeverKeyword + | TSNullKeyword + | TSNumberKeyword + | TSObjectKeyword + | TSStringKeyword + | TSSymbolKeyword + | TSUndefinedKeyword + | TSUnknownKeyword + | TSVoidKeyword + | TSArrayType + | TSConditionalType + | TSConstructorType + | TSFunctionType + | TSImportType + | TSIndexedAccessType + | TSInferType + | TSIntersectionType + | TSLiteralType + | TSMappedType + | TSNamedTupleMember + | TSQualifiedName + | TSTemplateLiteralType + | TSThisType + | TSTupleType + | TSTypeLiteral + | TSTypeOperator + | TSTypePredicate + | TSTypeQuery + | TSTypeReference + | TSUnionType + | TSParenthesizedType + | JSDocNullableType + | JSDocNonNullableType + | JSDocUnknownType; + +export interface TSAnyKeyword extends Span { + type: 'TSAnyKeyword'; +} + +export interface TSStringKeyword extends Span { + type: 'TSStringKeyword'; +} + +export interface TSBooleanKeyword extends Span { + type: 'TSBooleanKeyword'; +} + +export interface TSNumberKeyword extends Span { + type: 'TSNumberKeyword'; +} + +export interface TSNeverKeyword extends Span { + type: 'TSNeverKeyword'; +} + +export interface TSIntrinsicKeyword extends Span { + type: 'TSIntrinsicKeyword'; +} + +export interface TSUnknownKeyword extends Span { + type: 'TSUnknownKeyword'; +} + +export interface TSNullKeyword extends Span { + type: 'TSNullKeyword'; +} + +export interface TSUndefinedKeyword extends Span { + type: 'TSUndefinedKeyword'; +} + +export interface TSVoidKeyword extends Span { + type: 'TSVoidKeyword'; +} + +export interface TSSymbolKeyword extends Span { + type: 'TSSymbolKeyword'; +} + +export interface TSThisType extends Span { + type: 'TSThisType'; +} + +export interface TSObjectKeyword extends Span { + type: 'TSObjectKeyword'; +} + +export interface TSBigIntKeyword extends Span { + type: 'TSBigIntKeyword'; +} + +export interface TSTypeReference extends Span { + type: 'TSTypeReference'; + typeName: TSTypeName; + typeParameters: (TSTypeParameterInstantiation) | null; +} + +export type TSTypeName = IdentifierReference | TSQualifiedName; + +export interface TSQualifiedName extends Span { + type: 'TSQualifiedName'; + left: TSTypeName; + right: IdentifierName; +} + +export interface TSTypeParameterInstantiation extends Span { + type: 'TSTypeParameterInstantiation'; + params: Array; +} + +export interface TSTypeParameter extends Span { + type: 'TSTypeParameter'; + name: BindingIdentifier; + constraint: (TSType) | null; + default: (TSType) | null; + in: boolean; + out: boolean; + const: boolean; +} + +export interface TSTypeParameterDeclaration extends Span { + type: 'TSTypeParameterDeclaration'; + params: Array; +} + +export interface TSTypeAliasDeclaration extends Span { + type: 'TSTypeAliasDeclaration'; + id: BindingIdentifier; + typeParameters: (TSTypeParameterDeclaration) | null; + typeAnnotation: TSType; + declare: boolean; +} + +export type TSAccessibility = 'private' | 'protected' | 'public'; + +export interface TSClassImplements extends Span { + type: 'TSClassImplements'; + expression: TSTypeName; + typeParameters: (TSTypeParameterInstantiation) | null; +} + +export interface TSInterfaceDeclaration extends Span { + type: 'TSInterfaceDeclaration'; + id: BindingIdentifier; + extends: (Array) | null; + typeParameters: (TSTypeParameterDeclaration) | null; + body: TSInterfaceBody; + declare: boolean; +} + +export interface TSInterfaceBody extends Span { + type: 'TSInterfaceBody'; + body: Array; +} + +export interface TSPropertySignature extends Span { + type: 'TSPropertySignature'; + computed: boolean; + optional: boolean; + readonly: boolean; + key: PropertyKey; + typeAnnotation: (TSTypeAnnotation) | null; +} + +export type TSSignature = + | TSIndexSignature + | TSPropertySignature + | TSCallSignatureDeclaration + | TSConstructSignatureDeclaration + | TSMethodSignature; + +export interface TSIndexSignature extends Span { + type: 'TSIndexSignature'; + parameters: Array; + typeAnnotation: TSTypeAnnotation; + readonly: boolean; +} + +export interface TSCallSignatureDeclaration extends Span { + type: 'TSCallSignatureDeclaration'; + typeParameters: (TSTypeParameterDeclaration) | null; + thisParam: (TSThisParameter) | null; + params: FormalParameters; + returnType: (TSTypeAnnotation) | null; +} + +export type TSMethodSignatureKind = 'method' | 'get' | 'set'; + +export interface TSMethodSignature extends Span { + type: 'TSMethodSignature'; + key: PropertyKey; + computed: boolean; + optional: boolean; + kind: TSMethodSignatureKind; + typeParameters: (TSTypeParameterDeclaration) | null; + thisParam: (TSThisParameter) | null; + params: FormalParameters; + returnType: (TSTypeAnnotation) | null; +} + +export interface TSConstructSignatureDeclaration extends Span { + type: 'TSConstructSignatureDeclaration'; + typeParameters: (TSTypeParameterDeclaration) | null; + params: FormalParameters; + returnType: (TSTypeAnnotation) | null; +} + +export interface TSIndexSignatureName extends Span { + type: 'Identifier'; + name: string; + typeAnnotation: TSTypeAnnotation; +} + +export interface TSInterfaceHeritage extends Span { + type: 'TSInterfaceHeritage'; + expression: Expression; + typeParameters: (TSTypeParameterInstantiation) | null; +} + +export interface TSTypePredicate extends Span { + type: 'TSTypePredicate'; + parameterName: TSTypePredicateName; + asserts: boolean; + typeAnnotation: (TSTypeAnnotation) | null; +} + +export type TSTypePredicateName = IdentifierName | TSThisType; + +export interface TSModuleDeclaration extends Span { + type: 'TSModuleDeclaration'; + id: TSModuleDeclarationName; + body: (TSModuleDeclarationBody) | null; + kind: TSModuleDeclarationKind; + declare: boolean; +} + +export type TSModuleDeclarationKind = 'global' | 'module' | 'namespace'; + +export type TSModuleDeclarationName = BindingIdentifier | StringLiteral; + +export type TSModuleDeclarationBody = TSModuleDeclaration | TSModuleBlock; + +export interface TSModuleBlock extends Span { + type: 'TSModuleBlock'; + body: Array; +} + +export interface TSTypeLiteral extends Span { + type: 'TSTypeLiteral'; + members: Array; +} + +export interface TSInferType extends Span { + type: 'TSInferType'; + typeParameter: TSTypeParameter; +} + +export interface TSTypeQuery extends Span { + type: 'TSTypeQuery'; + exprName: TSTypeQueryExprName; + typeParameters: (TSTypeParameterInstantiation) | null; +} + +export type TSTypeQueryExprName = TSImportType | IdentifierReference | TSQualifiedName; + +export interface TSImportType extends Span { + type: 'TSImportType'; + isTypeOf: boolean; + parameter: TSType; + qualifier: (TSTypeName) | null; + attributes: (TSImportAttributes) | null; + typeParameters: (TSTypeParameterInstantiation) | null; +} + +export interface TSImportAttributes extends Span { + type: 'TSImportAttributes'; + attributesKeyword: IdentifierName; + elements: Array; +} + +export interface TSImportAttribute extends Span { + type: 'TSImportAttribute'; + name: TSImportAttributeName; + value: Expression; +} + +export type TSImportAttributeName = IdentifierName | StringLiteral; + +export interface TSFunctionType extends Span { + type: 'TSFunctionType'; + typeParameters: (TSTypeParameterDeclaration) | null; + thisParam: (TSThisParameter) | null; + params: FormalParameters; + returnType: TSTypeAnnotation; +} + +export interface TSConstructorType extends Span { + type: 'TSConstructorType'; + abstract: boolean; + typeParameters: (TSTypeParameterDeclaration) | null; + params: FormalParameters; + returnType: TSTypeAnnotation; +} + +export interface TSMappedType extends Span { + type: 'TSMappedType'; + typeParameter: TSTypeParameter; + nameType: (TSType) | null; + typeAnnotation: (TSType) | null; + optional: TSMappedTypeModifierOperator; + readonly: TSMappedTypeModifierOperator; +} + +export type TSMappedTypeModifierOperator = 'true' | '+' | '-' | 'none'; + +export interface TSTemplateLiteralType extends Span { + type: 'TSTemplateLiteralType'; + quasis: Array; + types: Array; +} + +export interface TSAsExpression extends Span { + type: 'TSAsExpression'; + expression: Expression; + typeAnnotation: TSType; +} + +export interface TSSatisfiesExpression extends Span { + type: 'TSSatisfiesExpression'; + expression: Expression; + typeAnnotation: TSType; +} + +export interface TSTypeAssertion extends Span { + type: 'TSTypeAssertion'; + expression: Expression; + typeAnnotation: TSType; +} + +export interface TSImportEqualsDeclaration extends Span { + type: 'TSImportEqualsDeclaration'; + id: BindingIdentifier; + moduleReference: TSModuleReference; + importKind: ImportOrExportKind; +} + +export type TSModuleReference = TSExternalModuleReference | IdentifierReference | TSQualifiedName; + +export interface TSExternalModuleReference extends Span { + type: 'TSExternalModuleReference'; + expression: StringLiteral; +} + +export interface TSNonNullExpression extends Span { + type: 'TSNonNullExpression'; + expression: Expression; +} + +export interface Decorator extends Span { + type: 'Decorator'; + expression: Expression; +} + +export interface TSExportAssignment extends Span { + type: 'TSExportAssignment'; + expression: Expression; +} + +export interface TSNamespaceExportDeclaration extends Span { + type: 'TSNamespaceExportDeclaration'; + id: IdentifierName; +} + +export interface TSInstantiationExpression extends Span { + type: 'TSInstantiationExpression'; + expression: Expression; + typeParameters: TSTypeParameterInstantiation; +} + +export type ImportOrExportKind = 'value' | 'type'; + +export interface JSDocNullableType extends Span { + type: 'JSDocNullableType'; + typeAnnotation: TSType; + postfix: boolean; +} + +export interface JSDocNonNullableType extends Span { + type: 'JSDocNonNullableType'; + typeAnnotation: TSType; + postfix: boolean; +} + +export interface JSDocUnknownType extends Span { + type: 'JSDocUnknownType'; +} + +export interface JSXElement extends Span { + type: 'JSXElement'; + openingElement: JSXOpeningElement; + closingElement: (JSXClosingElement) | null; + children: Array; +} + +export interface JSXOpeningElement extends Span { + type: 'JSXOpeningElement'; + selfClosing: boolean; + name: JSXElementName; + attributes: Array; + typeParameters: (TSTypeParameterInstantiation) | null; +} + +export interface JSXClosingElement extends Span { + type: 'JSXClosingElement'; + name: JSXElementName; +} + +export interface JSXFragment extends Span { + type: 'JSXFragment'; + openingFragment: JSXOpeningFragment; + closingFragment: JSXClosingFragment; + children: Array; +} + +export interface JSXOpeningFragment extends Span { + type: 'JSXOpeningFragment'; +} + +export interface JSXClosingFragment extends Span { + type: 'JSXClosingFragment'; +} + +export interface JSXNamespacedName extends Span { + type: 'JSXNamespacedName'; + namespace: JSXIdentifier; + property: JSXIdentifier; +} + +export interface JSXMemberExpression extends Span { + type: 'JSXMemberExpression'; + object: JSXMemberExpressionObject; + property: JSXIdentifier; +} + +export interface JSXExpressionContainer extends Span { + type: 'JSXExpressionContainer'; + expression: JSXExpression; +} + +export type JSXExpression = + | JSXEmptyExpression + | BooleanLiteral + | NullLiteral + | NumericLiteral + | BigIntLiteral + | RegExpLiteral + | StringLiteral + | TemplateLiteral + | IdentifierReference + | MetaProperty + | Super + | ArrayExpression + | ArrowFunctionExpression + | AssignmentExpression + | AwaitExpression + | BinaryExpression + | CallExpression + | ChainExpression + | Class + | ConditionalExpression + | Function + | ImportExpression + | LogicalExpression + | NewExpression + | ObjectExpression + | ParenthesizedExpression + | SequenceExpression + | TaggedTemplateExpression + | ThisExpression + | UnaryExpression + | UpdateExpression + | YieldExpression + | PrivateInExpression + | JSXElement + | JSXFragment + | TSAsExpression + | TSSatisfiesExpression + | TSTypeAssertion + | TSNonNullExpression + | TSInstantiationExpression + | ComputedMemberExpression + | StaticMemberExpression + | PrivateFieldExpression; + +export interface JSXEmptyExpression extends Span { + type: 'JSXEmptyExpression'; +} + +export type JSXAttributeItem = JSXAttribute | JSXSpreadAttribute; + +export interface JSXAttribute extends Span { + type: 'JSXAttribute'; + name: JSXAttributeName; + value: (JSXAttributeValue) | null; +} + +export interface JSXSpreadAttribute extends Span { + type: 'JSXSpreadAttribute'; + argument: Expression; +} + +export type JSXAttributeName = JSXIdentifier | JSXNamespacedName; + +export type JSXAttributeValue = StringLiteral | JSXExpressionContainer | JSXElement | JSXFragment; + +export interface JSXIdentifier extends Span { + type: 'JSXIdentifier'; + name: string; +} + +export type JSXChild = JSXText | JSXElement | JSXFragment | JSXExpressionContainer | JSXSpreadChild; + +export interface JSXSpreadChild extends Span { + type: 'JSXSpreadChild'; + expression: Expression; +} + +export interface JSXText extends Span { + type: 'JSXText'; + value: string; +} + +export type AssignmentOperator = + | '=' + | '+=' + | '-=' + | '*=' + | '/=' + | '%=' + | '<<=' + | '>>=' + | '>>>=' + | '|=' + | '^=' + | '&=' + | '&&=' + | '||=' + | '??=' + | '**='; + +export type BinaryOperator = + | '==' + | '!=' + | '===' + | '!==' + | '<' + | '<=' + | '>' + | '>=' + | '<<' + | '>>' + | '>>>' + | '+' + | '-' + | '*' + | '/' + | '%' + | '|' + | '^' + | '&' + | 'in' + | 'instanceof' + | '**'; + +export type LogicalOperator = '||' | '&&' | '??'; + +export type UnaryOperator = '-' | '+' | '!' | '~' | 'typeof' | 'void' | 'delete'; + +export type UpdateOperator = '++' | '--'; + +export interface Span { + start: number; + end: number; +} + +export interface SourceType { + language: Language; + moduleKind: ModuleKind; + variant: LanguageVariant; +} + +export type Language = 'javascript' | 'typescript' | 'typescriptDefinition'; + +export type ModuleKind = 'script' | 'module' | 'unambiguous'; + +export type LanguageVariant = 'standard' | 'jsx'; + +export interface Pattern extends Span { + type: 'Pattern'; + body: Disjunction; +} + +export interface Disjunction extends Span { + type: 'Disjunction'; + body: Array; +} + +export interface Alternative extends Span { + type: 'Alternative'; + body: Array; +} + +export type Term = + | BoundaryAssertion + | LookAroundAssertion + | Quantifier + | Character + | Dot + | CharacterClassEscape + | UnicodePropertyEscape + | CharacterClass + | CapturingGroup + | IgnoreGroup + | IndexedReference + | NamedReference; + +export interface BoundaryAssertion { + type: 'BoundaryAssertion'; + span: Span; + kind: BoundaryAssertionKind; +} + +export type BoundaryAssertionKind = 'start' | 'end' | 'boundary' | 'negativeBoundary'; + +export interface LookAroundAssertion extends Span { + type: 'LookAroundAssertion'; + kind: LookAroundAssertionKind; + body: Disjunction; +} + +export type LookAroundAssertionKind = 'lookahead' | 'negativeLookahead' | 'lookbehind' | 'negativeLookbehind'; + +export interface Quantifier extends Span { + type: 'Quantifier'; + min: number; + max: (number) | null; + greedy: boolean; + body: Term; +} + +export interface Character extends Span { + type: 'Character'; + kind: CharacterKind; + value: number; +} + +export type CharacterKind = + | 'controlLetter' + | 'hexadecimalEscape' + | 'identifier' + | 'null' + | 'octal1' + | 'octal2' + | 'octal3' + | 'singleEscape' + | 'symbol' + | 'unicodeEscape'; + +export interface CharacterClassEscape extends Span { + type: 'CharacterClassEscape'; + kind: CharacterClassEscapeKind; +} + +export type CharacterClassEscapeKind = 'd' | 'negativeD' | 's' | 'negativeS' | 'w' | 'negativeW'; + +export interface UnicodePropertyEscape extends Span { + type: 'UnicodePropertyEscape'; + negative: boolean; + strings: boolean; + name: string; + value: (string) | null; +} + +export interface Dot extends Span { + type: 'Dot'; +} + +export interface CharacterClass extends Span { + type: 'CharacterClass'; + negative: boolean; + strings: boolean; + kind: CharacterClassContentsKind; + body: Array; +} + +export type CharacterClassContentsKind = 'union' | 'intersection' | 'subtraction'; + +export type CharacterClassContents = + | CharacterClassRange + | CharacterClassEscape + | UnicodePropertyEscape + | Character + | CharacterClass + | ClassStringDisjunction; + +export interface CharacterClassRange extends Span { + type: 'CharacterClassRange'; + min: Character; + max: Character; +} + +export interface ClassStringDisjunction extends Span { + type: 'ClassStringDisjunction'; + strings: boolean; + body: Array; +} + +export interface ClassString extends Span { + type: 'ClassString'; + strings: boolean; + body: Array; +} + +export interface CapturingGroup extends Span { + type: 'CapturingGroup'; + name: (string) | null; + body: Disjunction; +} + +export interface IgnoreGroup extends Span { + type: 'IgnoreGroup'; + modifiers: (Modifiers) | null; + body: Disjunction; +} + +export interface Modifiers extends Span { + type: 'Modifiers'; + enabling: (Modifier) | null; + disabling: (Modifier) | null; +} + +export interface Modifier { + type: 'Modifier'; + ignoreCase: boolean; + multiline: boolean; + sticky: boolean; +} + +export interface IndexedReference extends Span { + type: 'IndexedReference'; + index: number; +} + +export interface NamedReference extends Span { + type: 'NamedReference'; + name: string; +} diff --git a/npm/oxc-types/src/index.d.ts b/npm/oxc-types/src/index.d.ts new file mode 100644 index 0000000000000..9d56cc82c0adf --- /dev/null +++ b/npm/oxc-types/src/index.d.ts @@ -0,0 +1 @@ +export * from './generated/types'; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 13f3279df7b11..6f66939a4186f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -58,6 +58,26 @@ importers: napi/transform: {} + npm/oxc-parser: {} + + npm/oxc-transform: {} + + npm/oxc-types: {} + + npm/oxc-wasm: + devDependencies: + '@oxc/types': + specifier: workspace:^ + version: link:../oxc-types + + npm/oxlint: {} + + npm/parser-wasm: + devDependencies: + '@oxc/types': + specifier: workspace:^ + version: link:../oxc-types + tasks/benchmark/codspeed: devDependencies: axios: @@ -70,7 +90,13 @@ importers: specifier: ^7.2.0 version: 7.4.3 - wasm/parser: {} + wasm/parser: + devDependencies: + '@oxc/types': + specifier: workspace:^ + version: link:../../npm/oxc-types + + wasm/parser/pkg: {} packages: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 774cb9406c1ac..cf4358978a66a 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -3,6 +3,7 @@ packages: - 'wasm/**' - 'editors/**' - 'tasks/benchmark/codspeed' + - 'npm/**' catalog: "@napi-rs/cli": 3.0.0-alpha.61 diff --git a/tasks/ast_tools/src/derives/estree.rs b/tasks/ast_tools/src/derives/estree.rs index 6f893163f43b5..4c1a41e79038e 100644 --- a/tasks/ast_tools/src/derives/estree.rs +++ b/tasks/ast_tools/src/derives/estree.rs @@ -1,5 +1,4 @@ use convert_case::{Case, Casing}; -use itertools::Itertools; use proc_macro2::TokenStream; use quote::quote; @@ -9,7 +8,7 @@ use crate::{ markers::ESTreeStructAttribute, schema::{ serialize::{enum_variant_name, get_type_tag}, - EnumDef, GetGenerics, GetIdent, StructDef, TypeDef, TypeName, + EnumDef, GetGenerics, GetIdent, StructDef, TypeDef, }, }; @@ -27,19 +26,6 @@ impl Derive for DeriveESTree { } fn derive(&mut self, def: &TypeDef, _: &LateCtx) -> TokenStream { - let ts_type_def = match def { - TypeDef::Enum(def) => typescript_enum(def), - TypeDef::Struct(def) => Some(typescript_struct(def)), - }; - let ts_type_def = if let Some(ts_type_def) = ts_type_def { - quote! { - #[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] - const TS_APPEND_CONTENT: &'static str = #ts_type_def; - } - } else { - TokenStream::new() - }; - if let TypeDef::Struct(def) = def { if def .markers @@ -47,7 +33,7 @@ impl Derive for DeriveESTree { .as_ref() .is_some_and(|e| e == &ESTreeStructAttribute::CustomSerialize) { - return ts_type_def; + return TokenStream::new(); } } @@ -64,9 +50,6 @@ impl Derive for DeriveESTree { #body } } - - ///@@line_break - #ts_type_def } } @@ -171,72 +154,3 @@ fn serialize_enum(def: &EnumDef) -> TokenStream { } } } - -// Untagged enums: "type Expression = BooleanLiteral | NullLiteral" -// Tagged enums: "type PropertyKind = 'init' | 'get' | 'set'" -fn typescript_enum(def: &EnumDef) -> Option { - if def.markers.estree.custom_ts_def { - return None; - } - - let union = if def.markers.estree.untagged { - def.all_variants().map(|var| type_to_string(var.fields[0].typ.name())).join(" | ") - } else { - def.all_variants().map(|var| format!("'{}'", enum_variant_name(var, def))).join(" | ") - }; - let ident = def.ident(); - Some(format!("export type {ident} = {union};")) -} - -fn typescript_struct(def: &StructDef) -> String { - let ident = def.ident(); - let mut fields = String::new(); - let mut extends = vec![]; - - if let Some(type_tag) = get_type_tag(def) { - fields.push_str(&format!("\n\ttype: '{type_tag}';")); - } - - for field in &def.fields { - if field.markers.derive_attributes.estree.skip { - continue; - } - let ty = match &field.markers.derive_attributes.tsify_type { - Some(ty) => ty.clone(), - None => type_to_string(field.typ.name()), - }; - - if field.markers.derive_attributes.estree.flatten { - extends.push(ty); - continue; - } - - let name = match &field.markers.derive_attributes.estree.rename { - Some(rename) => rename.to_string(), - None => field.name.clone().unwrap().to_case(Case::Camel), - }; - - fields.push_str(&format!("\n\t{name}: {ty};")); - } - let extends = - if extends.is_empty() { String::new() } else { format!(" & {}", extends.join(" & ")) }; - format!("export type {ident} = ({{{fields}\n}}){extends};") -} - -fn type_to_string(ty: &TypeName) -> String { - match ty { - TypeName::Ident(ident) => match ident.as_str() { - "f64" | "f32" | "usize" | "u64" | "u32" | "u16" | "u8" | "i64" | "i32" | "i16" - | "i8" => "number", - "bool" => "boolean", - "str" | "String" | "Atom" | "CompactStr" => "string", - ty => ty, - } - .to_string(), - TypeName::Vec(type_name) => format!("Array<{}>", type_to_string(type_name)), - TypeName::Box(type_name) | TypeName::Ref(type_name) | TypeName::Complex(type_name) => { - type_to_string(type_name) - } - TypeName::Opt(type_name) => format!("({}) | null", type_to_string(type_name)), - } -} diff --git a/tasks/ast_tools/src/generators/mod.rs b/tasks/ast_tools/src/generators/mod.rs index bd8df1f3e3d17..6d89625b13550 100644 --- a/tasks/ast_tools/src/generators/mod.rs +++ b/tasks/ast_tools/src/generators/mod.rs @@ -7,11 +7,13 @@ use crate::codegen::LateCtx; mod assert_layouts; mod ast_builder; mod ast_kind; +mod typescript; mod visit; pub use assert_layouts::AssertLayouts; pub use ast_builder::AstBuilderGenerator; pub use ast_kind::AstKindGenerator; +pub use typescript::TypescriptGenerator; pub use visit::{VisitGenerator, VisitMutGenerator}; /// Inserts a newline in the `TokenStream`. @@ -28,15 +30,8 @@ pub trait Generator { #[derive(Debug, Clone)] pub enum GeneratorOutput { - Rust { - path: PathBuf, - tokens: TokenStream, - }, - #[expect(dead_code)] - Text { - path: PathBuf, - content: String, - }, + Rust { path: PathBuf, tokens: TokenStream }, + Text { path: PathBuf, content: String }, } macro_rules! define_generator { diff --git a/tasks/ast_tools/src/generators/typescript.rs b/tasks/ast_tools/src/generators/typescript.rs new file mode 100644 index 0000000000000..5814334cd9bcf --- /dev/null +++ b/tasks/ast_tools/src/generators/typescript.rs @@ -0,0 +1,170 @@ +use convert_case::{Case, Casing}; +use itertools::Itertools; +use std::{ + io::Write, + process::{Command, Stdio}, +}; + +use super::define_generator; +use crate::{ + codegen::LateCtx, + output, + schema::{ + serialize::{enum_variant_name, get_type_tag}, + EnumDef, GetIdent, StructDef, TypeDef, TypeName, + }, + Generator, GeneratorOutput, +}; + +const CUSTOM_TYPESCRIPT: &str = include_str!("../../../../crates/oxc_ast/src/ast/types.d.ts"); + +define_generator! { + pub struct TypescriptGenerator; +} + +impl Generator for TypescriptGenerator { + fn generate(&mut self, ctx: &LateCtx) -> GeneratorOutput { + let file = file!().replace('\\', "/"); + let mut content = format!( + "\ + // To edit this generated file you have to edit `{file}`\n\ + // Auto-generated code, DO NOT EDIT DIRECTLY!\n\n\ + {CUSTOM_TYPESCRIPT}\n\ + " + ); + + for def in ctx.schema() { + if !def.generates_derive("ESTree") { + continue; + } + let ts_type_def = match def { + TypeDef::Struct(it) => Some(typescript_struct(it)), + TypeDef::Enum(it) => typescript_enum(it), + }; + let Some(ts_type_def) = ts_type_def else { continue }; + + content.push_str(&ts_type_def); + content.push_str("\n\n"); + } + GeneratorOutput::Text { + path: output(crate::TYPESCRIPT_PACKAGE, "types.d.ts"), + content: format_typescript(&content), + } + } +} + +// Untagged enums: "type Expression = BooleanLiteral | NullLiteral" +// Tagged enums: "type PropertyKind = 'init' | 'get' | 'set'" +fn typescript_enum(def: &EnumDef) -> Option { + if def.markers.estree.custom_ts_def { + return None; + } + + let union = if def.markers.estree.untagged { + def.all_variants().map(|var| type_to_string(var.fields[0].typ.name())).join(" | ") + } else { + def.all_variants().map(|var| format!("'{}'", enum_variant_name(var, def))).join(" | ") + }; + let ident = def.ident(); + Some(format!("export type {ident} = {union};")) +} + +fn typescript_struct(def: &StructDef) -> String { + let ident = def.ident(); + let mut fields = String::new(); + let mut extends = vec![]; + + if let Some(type_tag) = get_type_tag(def) { + fields.push_str(&format!("\n\ttype: '{type_tag}';")); + } + + for field in &def.fields { + if field.markers.derive_attributes.estree.skip { + continue; + } + let ty = match &field.markers.derive_attributes.tsify_type { + Some(ty) => ty.clone(), + None => type_to_string(field.typ.name()), + }; + + if field.markers.derive_attributes.estree.flatten { + extends.push(ty); + continue; + } + + let name = match &field.markers.derive_attributes.estree.rename { + Some(rename) => rename.to_string(), + None => field.name.clone().unwrap().to_case(Case::Camel), + }; + + fields.push_str(&format!("\n\t{name}: {ty};")); + } + + let extends_union = extends.iter().any(|it| it.contains('|')); + + if extends_union { + let extends = + if extends.is_empty() { String::new() } else { format!(" & {}", extends.join(" & ")) }; + format!("export type {ident} = ({{{fields}\n}}){extends};") + } else { + let extends = if extends.is_empty() { + String::new() + } else { + format!(" extends {}", extends.join(", ")) + }; + format!("export interface {ident}{extends} {{{fields}\n}}") + } +} + +fn type_to_string(ty: &TypeName) -> String { + match ty { + TypeName::Ident(ident) => match ident.as_str() { + "f64" | "f32" | "usize" | "u64" | "u32" | "u16" | "u8" | "i64" | "i32" | "i16" + | "i8" => "number", + "bool" => "boolean", + "str" | "String" | "Atom" | "CompactStr" => "string", + ty => ty, + } + .to_string(), + TypeName::Vec(type_name) => format!("Array<{}>", type_to_string(type_name)), + TypeName::Box(type_name) | TypeName::Ref(type_name) | TypeName::Complex(type_name) => { + type_to_string(type_name) + } + TypeName::Opt(type_name) => format!("({}) | null", type_to_string(type_name)), + } +} + +fn format_typescript(source_text: &str) -> String { + let mut dprint = Command::new("dprint") + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .args(["fmt", "--stdin", "types.d.ts"]) + .spawn() + .expect("Failed to run dprint (is it installed?)"); + + let stdin = dprint.stdin.as_mut().unwrap(); + stdin.write_all(source_text.as_bytes()).unwrap(); + stdin.flush().unwrap(); + + let output = dprint.wait_with_output().unwrap(); + String::from_utf8(output.stdout).unwrap() +} + +// Unusable until oxc_prettier supports comments +// fn format_typescript(source_text: &str) -> String { +// let allocator = Allocator::default(); +// let source_type = SourceType::ts(); +// let ret = Parser::new(&allocator, source_text, source_type) +// .with_options(ParseOptions { preserve_parens: false, ..ParseOptions::default() }) +// .parse(); +// Prettier::new( +// &allocator, +// PrettierOptions { +// semi: true, +// trailing_comma: TrailingComma::All, +// single_quote: true, +// ..PrettierOptions::default() +// }, +// ) +// .build(&ret.program) +// } diff --git a/tasks/ast_tools/src/main.rs b/tasks/ast_tools/src/main.rs index c500924f418c4..9d9275f787ad6 100644 --- a/tasks/ast_tools/src/main.rs +++ b/tasks/ast_tools/src/main.rs @@ -24,7 +24,7 @@ use derives::{ use fmt::cargo_fmt; use generators::{ AssertLayouts, AstBuilderGenerator, AstKindGenerator, Generator, GeneratorOutput, - VisitGenerator, VisitMutGenerator, + TypescriptGenerator, VisitGenerator, VisitMutGenerator, }; use passes::{CalcLayout, Linker}; use util::{write_all_to, NormalizeError}; @@ -43,6 +43,7 @@ static SOURCE_PATHS: &[&str] = &[ ]; const AST_CRATE: &str = "crates/oxc_ast"; +const TYPESCRIPT_PACKAGE: &str = "npm/oxc-types"; type Result = std::result::Result; type TypeId = usize; @@ -84,6 +85,7 @@ fn main() -> std::result::Result<(), Box> { .generate(AstBuilderGenerator) .generate(VisitGenerator) .generate(VisitMutGenerator) + .generate(TypescriptGenerator) .run()?; if !cli_options.dry_run { diff --git a/wasm/parser/package.json b/wasm/parser/package.json index ba26f82b5c5ca..fe3a50a5a0c06 100644 --- a/wasm/parser/package.json +++ b/wasm/parser/package.json @@ -26,6 +26,9 @@ "node", "web" ], + "devDependencies": { + "@oxc/types": "workspace:^" + }, "scripts": { "build": "pnpm run build-node && pnpm run build-web && pnpm run copy-files && pnpm run clean-files", "build-node": "pnpm run build-base --target nodejs --out-dir ../../npm/parser-wasm/node .", diff --git a/wasm/parser/src/lib.rs b/wasm/parser/src/lib.rs index a08dcf81d1158..0a850cb3e5852 100644 --- a/wasm/parser/src/lib.rs +++ b/wasm/parser/src/lib.rs @@ -7,6 +7,12 @@ use serde::{Deserialize, Serialize}; use tsify::Tsify; use wasm_bindgen::prelude::*; +#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] +const TS_APPEND_CONTENT: &'static str = r#" +import type { Program } from "@oxc/types"; +export * from "@oxc/types"; +"#; + #[derive(Debug, Default, Clone, Deserialize, Tsify)] #[tsify(from_wasm_abi)] #[serde(rename_all = "camelCase")]