mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
parent
07f34c51d8
commit
acc2d16b41
2 changed files with 402 additions and 80 deletions
|
|
@ -1,7 +1,7 @@
|
|||
//! TypeScript Definitions
|
||||
//!
|
||||
//! [AST Spec](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/ast-spec)
|
||||
//! [Archived TypeScript spec](https://github.com/microsoft/TypeScript/blob/3c99d50da5a579d9fa92d02664b1b66d4ff55944/doc/spec-ARCHIVED.md)
|
||||
//! - [AST Spec](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/ast-spec)
|
||||
//! - [Archived TypeScript spec](https://github.com/microsoft/TypeScript/blob/3c99d50da5a579d9fa92d02664b1b66d4ff55944/doc/spec-ARCHIVED.md)
|
||||
|
||||
// NB: `#[span]`, `#[scope(...)]`,`#[visit(...)]` and `#[generate_derive(...)]` do NOT do anything to the code.
|
||||
// They are purely markers for codegen used in `tasks/ast_tools` and `crates/oxc_traverse/scripts`. See docs in those crates.
|
||||
|
|
@ -33,6 +33,16 @@ export interface TSIndexSignatureName extends Span {
|
|||
}
|
||||
"#;
|
||||
|
||||
/// TypeScript `this` parameter
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// type T = (this: string, a: number) => void
|
||||
/// // ^^^^^^^^^^^^
|
||||
/// ```
|
||||
///
|
||||
/// ## Reference
|
||||
/// * [TypeScript Handbook - `this` parameters](https://www.typescriptlang.org/docs/handbook/2/functions.html#this-parameters)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -42,6 +52,7 @@ pub struct TSThisParameter<'a> {
|
|||
#[serde(flatten)]
|
||||
pub span: Span,
|
||||
pub this_span: Span,
|
||||
/// Type type the `this` keyword will have in the function
|
||||
pub type_annotation: Option<Box<'a, TSTypeAnnotation<'a>>>,
|
||||
}
|
||||
|
||||
|
|
@ -62,6 +73,9 @@ pub struct TSThisParameter<'a> {
|
|||
/// B
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// ## Reference
|
||||
/// * [TypeScript Handbook - Enums](https://www.typescriptlang.org/docs/handbook/enums.html)
|
||||
#[ast(visit)]
|
||||
#[scope]
|
||||
#[derive(Debug)]
|
||||
|
|
@ -74,6 +88,7 @@ pub struct TSEnumDeclaration<'a> {
|
|||
pub id: BindingIdentifier<'a>,
|
||||
#[scope(enter_before)]
|
||||
pub members: Vec<'a, TSEnumMember<'a>>,
|
||||
/// `true` for const enums
|
||||
pub r#const: bool,
|
||||
pub declare: bool,
|
||||
#[serde(skip)]
|
||||
|
|
@ -83,8 +98,9 @@ pub struct TSEnumDeclaration<'a> {
|
|||
|
||||
/// Enum Member
|
||||
///
|
||||
/// ## Example
|
||||
/// A member property in a [`TSEnumDeclaration`].
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// enum Foo {
|
||||
/// // _ id
|
||||
|
|
@ -94,6 +110,9 @@ pub struct TSEnumDeclaration<'a> {
|
|||
///
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// ## Reference
|
||||
/// * [TypeScript Handbook - Enums](https://www.typescriptlang.org/docs/handbook/enums.html)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -109,7 +128,8 @@ pub struct TSEnumMember<'a> {
|
|||
inherit_variants! {
|
||||
/// TS Enum Member Name
|
||||
///
|
||||
/// Inherits variants from [`Expression`]. See [`ast` module docs] for explanation of inheritance.
|
||||
/// Used in [`TSEnumMember`]. Inherits variants from [`Expression`]. See [`ast` module docs] for
|
||||
/// explanation of inheritance.
|
||||
///
|
||||
/// [`ast` module docs]: `super`
|
||||
#[ast(visit)]
|
||||
|
|
@ -150,6 +170,7 @@ pub struct TSTypeAnnotation<'a> {
|
|||
#[serde(flatten)]
|
||||
/// starts at the `:` token and ends at the end of the type annotation
|
||||
pub span: Span,
|
||||
/// The actual type in the annotation
|
||||
pub type_annotation: TSType<'a>,
|
||||
}
|
||||
|
||||
|
|
@ -178,6 +199,7 @@ pub struct TSLiteralType<'a> {
|
|||
pub literal: TSLiteral<'a>,
|
||||
}
|
||||
|
||||
/// A literal in a [`TSLiteralType`].
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -198,6 +220,13 @@ pub enum TSLiteral<'a> {
|
|||
///
|
||||
/// This is the root-level type for TypeScript types, kind of like [`Expression`] is for
|
||||
/// expressions.
|
||||
///
|
||||
/// ## Examples
|
||||
/// ```ts
|
||||
/// // Foo is a TSTypeAlias
|
||||
/// type Foo = number | string
|
||||
/// // ^^^^^^^^^^^^^^^ TSType::TSUnionType
|
||||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -296,12 +325,16 @@ pub use match_ts_type;
|
|||
/// TypeScript Conditional Type
|
||||
///
|
||||
/// ## Example
|
||||
///
|
||||
/// ```ts
|
||||
/// SomeType extends OtherType ? TrueType : FalseType;
|
||||
/// type GetProperty<T extends string> =
|
||||
/// // _ check_type
|
||||
/// T extends `${string}.${infer U}` // <- extends_type
|
||||
/// ? U // <- true_type
|
||||
/// : never; // <- false_type
|
||||
/// ```
|
||||
///
|
||||
/// <https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#handbook-content>
|
||||
/// ## Reference
|
||||
/// * [TypeScript Handbook - Conditional Types](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html)
|
||||
#[ast(visit)]
|
||||
#[scope]
|
||||
#[derive(Debug)]
|
||||
|
|
@ -311,9 +344,13 @@ pub use match_ts_type;
|
|||
pub struct TSConditionalType<'a> {
|
||||
#[serde(flatten)]
|
||||
pub span: Span,
|
||||
/// The type before `extends` in the test expression.
|
||||
pub check_type: TSType<'a>,
|
||||
/// The type `check_type` is being tested against.
|
||||
pub extends_type: TSType<'a>,
|
||||
/// The type evaluated to if the test is true.
|
||||
pub true_type: TSType<'a>,
|
||||
/// The type evaluated to if the test is false.
|
||||
pub false_type: TSType<'a>,
|
||||
#[serde(skip)]
|
||||
#[clone_in(default)]
|
||||
|
|
@ -323,12 +360,12 @@ pub struct TSConditionalType<'a> {
|
|||
/// TypeScript Union Type
|
||||
///
|
||||
/// ## Example
|
||||
///
|
||||
/// ```ts
|
||||
/// string | string[] | (() => string) | { s: string }
|
||||
/// ```
|
||||
///
|
||||
/// <https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes-func.html#unions>
|
||||
/// ## Reference
|
||||
/// * [TypeScript Handbook - Union Types](https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes-func.html#unions)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -337,12 +374,23 @@ pub struct TSConditionalType<'a> {
|
|||
pub struct TSUnionType<'a> {
|
||||
#[serde(flatten)]
|
||||
pub span: Span,
|
||||
/// The types in the union.
|
||||
pub types: Vec<'a, TSType<'a>>,
|
||||
}
|
||||
|
||||
/// type `ColorfulCircle` = Colorful & Circle;
|
||||
/// TypeScript Intersection Type
|
||||
///
|
||||
/// <https://www.typescriptlang.org/docs/handbook/2/objects.html#intersection-types>
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// type Colorful = { color: string };
|
||||
/// type Circle = { radius: number };
|
||||
///
|
||||
/// // `types` will be `[Colorful, Circle]`
|
||||
/// type ColorfulCircle = Colorful & Circle;
|
||||
/// ```
|
||||
///
|
||||
/// ## Reference
|
||||
/// * [TypeScript Handbook - Intersection Types](https://www.typescriptlang.org/docs/handbook/2/objects.html#intersection-types)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -354,6 +402,15 @@ pub struct TSIntersectionType<'a> {
|
|||
pub types: Vec<'a, TSType<'a>>,
|
||||
}
|
||||
|
||||
/// Parenthesized Type
|
||||
///
|
||||
/// Like [`ParenthesizedExpression`], but for types.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// type Foo = (string | number);
|
||||
/// // ^^^^^^^^^^^^^^^^ type_annotation
|
||||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -372,7 +429,8 @@ pub struct TSParenthesizedType<'a> {
|
|||
/// - `unique`
|
||||
/// - `readonly`
|
||||
///
|
||||
/// <https://www.typescriptlang.org/docs/handbook/2/keyof-types.html>
|
||||
/// ## References
|
||||
/// * [TypeScript Handbook - Keyof Types](https://www.typescriptlang.org/docs/handbook/2/keyof-types.html)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -382,9 +440,11 @@ pub struct TSTypeOperator<'a> {
|
|||
#[serde(flatten)]
|
||||
pub span: Span,
|
||||
pub operator: TSTypeOperatorOperator,
|
||||
/// The type being operated on
|
||||
pub type_annotation: TSType<'a>,
|
||||
}
|
||||
|
||||
/// Operator in a [`TSTypeOperator`].
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash)]
|
||||
|
|
@ -471,6 +531,16 @@ pub struct TSTupleType<'a> {
|
|||
pub element_types: Vec<'a, TSTupleElement<'a>>,
|
||||
}
|
||||
|
||||
/// TypeScript Named Tuple Member
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// type Foo = [first: string, second: number];
|
||||
/// // ^^^^^^^^^^^^^
|
||||
/// ```
|
||||
///
|
||||
/// ## Reference
|
||||
/// * [TypeScript Handbook - Tuple Types](https://www.typescriptlang.org/docs/handbook/2/objects.html#tuple-types)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -484,6 +554,15 @@ pub struct TSNamedTupleMember<'a> {
|
|||
pub optional: bool,
|
||||
}
|
||||
|
||||
/// TypeScript Optional Type
|
||||
///
|
||||
/// Note that this does not cover optional object or class properties.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// type Foo = [number?]
|
||||
/// // ^^^^^^ type_annotation
|
||||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -495,6 +574,14 @@ pub struct TSOptionalType<'a> {
|
|||
pub type_annotation: TSType<'a>,
|
||||
}
|
||||
|
||||
/// TypeScript Rest Type
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// // ___________ this is the rest type
|
||||
/// type Foo = [number, ...string[]]
|
||||
/// // ^^^^^^^^ type_annotation
|
||||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -529,6 +616,15 @@ pub enum TSTupleElement<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// TypeScript `any` keyword
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// type Foo = any;
|
||||
/// ```
|
||||
///
|
||||
/// ## Reference
|
||||
/// * [TypeScript Handbook - Any Type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -539,6 +635,15 @@ pub struct TSAnyKeyword {
|
|||
pub span: Span,
|
||||
}
|
||||
|
||||
/// TypeScript `string` keyword
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// type Foo = string;
|
||||
/// ```
|
||||
///
|
||||
/// ## Reference
|
||||
/// * [TypeScript Handbook - Everyday Types](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#the-primitives-string-number-and-boolean)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -549,6 +654,15 @@ pub struct TSStringKeyword {
|
|||
pub span: Span,
|
||||
}
|
||||
|
||||
/// TypeScript `boolean` keyword
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// type Foo = boolean;
|
||||
/// ```
|
||||
///
|
||||
/// ## Reference
|
||||
/// * [TypeScript Handbook - Everyday Types](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#the-primitives-string-number-and-boolean)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -559,6 +673,15 @@ pub struct TSBooleanKeyword {
|
|||
pub span: Span,
|
||||
}
|
||||
|
||||
/// TypeScript `number` keyword
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// type Foo = boolean;
|
||||
/// ```
|
||||
///
|
||||
/// ## Reference
|
||||
/// * [TypeScript Handbook - Everyday Types](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#the-primitives-string-number-and-boolean)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -569,6 +692,16 @@ pub struct TSNumberKeyword {
|
|||
pub span: Span,
|
||||
}
|
||||
|
||||
/// TypeScript `never` Keyword
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// type Foo<T> = T extends string ? never : T;
|
||||
/// // ^^^^^
|
||||
/// ```
|
||||
///
|
||||
/// ## Reference
|
||||
/// * [TypeScript Handbook - Advanced Topics](https://www.typescriptlang.org/docs/handbook/type-compatibility.html#advanced-topics)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -579,7 +712,16 @@ pub struct TSNeverKeyword {
|
|||
pub span: Span,
|
||||
}
|
||||
|
||||
/// TypeScript `intrinsic` Keyword
|
||||
///
|
||||
/// Intrinsic types are built into TypeScript and are not user-defined.
|
||||
/// ## Example
|
||||
/// `type Uppercase<T extends character> = intrinsic;`
|
||||
///
|
||||
/// ### References
|
||||
/// * [TypeScript Handbook - Intrinsic String Manipulation
|
||||
/// Types](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#intrinsic-string-manipulation-types)
|
||||
/// * [microsoft/TypeScript #40580](https://github.com/microsoft/TypeScript/pull/40580)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -590,6 +732,17 @@ pub struct TSIntrinsicKeyword {
|
|||
pub span: Span,
|
||||
}
|
||||
|
||||
/// TypeScript `unknown` Keyword
|
||||
///
|
||||
/// This is like `any`, but is not assignable to anything except `any` and `unknown`.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// type Foo = unknown;
|
||||
/// ```
|
||||
///
|
||||
/// ## Reference
|
||||
/// * [TypeScript Handbook - Advanced Topics](https://www.typescriptlang.org/docs/handbook/type-compatibility.html#advanced-topics)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -600,6 +753,16 @@ pub struct TSUnknownKeyword {
|
|||
pub span: Span,
|
||||
}
|
||||
|
||||
/// TypeScript `null` Keyword
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// type Foo = string | null;
|
||||
/// // ^^^^
|
||||
/// ```
|
||||
///
|
||||
/// ## Reference
|
||||
/// * [TypeScript Handbook - Everyday Types](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#null-and-undefined)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -610,6 +773,18 @@ pub struct TSNullKeyword {
|
|||
pub span: Span,
|
||||
}
|
||||
|
||||
/// TypeScript `null` Keyword
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// type Foo = string | undefined;
|
||||
/// // ^^^^^^^^^
|
||||
/// ```
|
||||
///
|
||||
/// ## Reference
|
||||
/// * [TypeScript Handbook - Everyday Types](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#null-and-undefined)
|
||||
/// ## Reference
|
||||
/// * [TypeScript Handbook - Everyday Types](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#null-and-undefined)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -670,9 +845,14 @@ pub struct TSBigIntKeyword {
|
|||
pub span: Span,
|
||||
}
|
||||
|
||||
/// TypeScript Type Reference
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// type C = A;
|
||||
/// type D = B.a;
|
||||
/// type E = D.c.b.a;
|
||||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -707,6 +887,14 @@ macro_rules! match_ts_type_name {
|
|||
}
|
||||
pub use match_ts_type_name;
|
||||
|
||||
/// TypeScript Qualified Name
|
||||
///
|
||||
/// A [type reference](TSTypeReference) qualified by a namespace.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// type Foo = A.B.C;
|
||||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -730,6 +918,23 @@ pub struct TSTypeParameterInstantiation<'a> {
|
|||
pub params: Vec<'a, TSType<'a>>,
|
||||
}
|
||||
|
||||
/// TypeScript Type Parameter
|
||||
///
|
||||
/// This is a type parameter in a generic type or function.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// // ______ constraint
|
||||
/// type Box<T extends string = 'foo'> = { value: T };
|
||||
/// // name ^ ^^^^^ default
|
||||
///
|
||||
/// function add<in T>(a: T, b: T): T { return a + b; }
|
||||
/// // ^^ in: true
|
||||
/// ```
|
||||
///
|
||||
/// ## References
|
||||
/// * [TypeScript Handbook - Generics](https://www.typescriptlang.org/docs/handbook/2/generics.html)
|
||||
/// * [TypeScript Handbook - Variance Annotations](https://www.typescriptlang.org/docs/handbook/2/generics.html#variance-annotations)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -738,11 +943,17 @@ pub struct TSTypeParameterInstantiation<'a> {
|
|||
pub struct TSTypeParameter<'a> {
|
||||
#[serde(flatten)]
|
||||
pub span: Span,
|
||||
/// The name of the parameter, e.g. `T` in `type Foo<T> = ...`.
|
||||
pub name: BindingIdentifier<'a>,
|
||||
/// Constrains what types can be passed to the type parameter.
|
||||
pub constraint: Option<TSType<'a>>,
|
||||
/// Default value of the type parameter if no type is provided when using the type.
|
||||
pub default: Option<TSType<'a>>,
|
||||
/// Was an `in` modifier keyword present?
|
||||
pub r#in: bool,
|
||||
/// Was an `out` modifier keyword present?
|
||||
pub out: bool,
|
||||
/// Was a `const` modifier keyword present?
|
||||
pub r#const: bool,
|
||||
}
|
||||
|
||||
|
|
@ -757,6 +968,14 @@ pub struct TSTypeParameterDeclaration<'a> {
|
|||
pub params: Vec<'a, TSTypeParameter<'a>>,
|
||||
}
|
||||
|
||||
/// TypeScript Type Alias Declaration Statement
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// // _____ id
|
||||
/// type Maybe<T> = T | null | undefined;
|
||||
/// // ^ type_parameters
|
||||
/// ```
|
||||
#[ast(visit)]
|
||||
#[scope]
|
||||
#[derive(Debug)]
|
||||
|
|
@ -766,6 +985,7 @@ pub struct TSTypeParameterDeclaration<'a> {
|
|||
pub struct TSTypeAliasDeclaration<'a> {
|
||||
#[serde(flatten)]
|
||||
pub span: Span,
|
||||
/// Type alias's identifier, e.g. `Foo` in `type Foo = number`.
|
||||
pub id: BindingIdentifier<'a>,
|
||||
#[scope(enter_before)]
|
||||
pub type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>,
|
||||
|
|
@ -787,6 +1007,16 @@ pub enum TSAccessibility {
|
|||
Public = 2,
|
||||
}
|
||||
|
||||
/// TypeScript Class Interface Heritage
|
||||
///
|
||||
/// `implements` clause of a [class declaration](Class).
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// // ___ expression
|
||||
/// class Foo implements Bar, Baz<number, string> {}
|
||||
/// // type_parameters ^^^^^^^^^^^^^^
|
||||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -799,9 +1029,21 @@ pub struct TSClassImplements<'a> {
|
|||
pub type_parameters: Option<Box<'a, TSTypeParameterInstantiation<'a>>>,
|
||||
}
|
||||
|
||||
/// Interface Declaration
|
||||
/// TypeScriptInterface Declaration
|
||||
///
|
||||
/// interface `BindingIdentifier` `TypeParameters_opt` `InterfaceExtendsClause_opt` `ObjectType`
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// // ___ extends
|
||||
/// interface Foo<T> extends Bar {
|
||||
/// // id ^^^ ^ type_parameters
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// ## References
|
||||
/// * [TypeScript in 5 Minutes - Interfaces](https://www.typescriptlang.org/docs/handbook/typescript-tooling-in-5-minutes.html#interfaces)
|
||||
/// * [TypeScript Handbook - Interfaces](https://www.typescriptlang.org/docs/handbook/2/objects.html#interfaces)
|
||||
#[ast(visit)]
|
||||
#[scope]
|
||||
#[derive(Debug)]
|
||||
|
|
@ -813,16 +1055,20 @@ pub struct TSInterfaceDeclaration<'a> {
|
|||
pub span: Span,
|
||||
/// The identifier (name) of the interface.
|
||||
pub id: BindingIdentifier<'a>,
|
||||
/// Other interfaces/types this interface extends.
|
||||
#[scope(enter_before)]
|
||||
pub extends: Option<Vec<'a, TSInterfaceHeritage<'a>>>,
|
||||
/// Type parameters that get bound to the interface.
|
||||
pub type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>,
|
||||
pub body: Box<'a, TSInterfaceBody<'a>>,
|
||||
/// `true` for `declare interface Foo {}`
|
||||
pub declare: bool,
|
||||
#[serde(skip)]
|
||||
#[clone_in(default)]
|
||||
pub scope_id: Cell<Option<ScopeId>>,
|
||||
}
|
||||
|
||||
/// Body of a [`TSInterfaceDeclaration`].
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -834,6 +1080,21 @@ pub struct TSInterfaceBody<'a> {
|
|||
pub body: Vec<'a, TSSignature<'a>>,
|
||||
}
|
||||
|
||||
/// TypeScript Property Signature
|
||||
///
|
||||
/// Used in [classes](Class), [interfaces](TSInterfaceDeclaration), [mapped types](TSMappedType),
|
||||
/// etc. Part of a [`TSSignature`].
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// interface Foo {
|
||||
/// // ___ key
|
||||
/// bar: number
|
||||
/// // ^^^^^^^^ type_annotation
|
||||
/// baz?: string // <- optional
|
||||
/// readony bang: boolean // <- readonly
|
||||
/// }
|
||||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -911,6 +1172,17 @@ pub enum TSMethodSignatureKind {
|
|||
Set = 2,
|
||||
}
|
||||
|
||||
/// TypeScript Method Signature
|
||||
///
|
||||
/// Similar to a [`TSFunctionType`], but only for method shorthand syntax.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// interface Foo {
|
||||
/// bar(a: number): string;
|
||||
/// // ^^^ key
|
||||
/// }
|
||||
/// ```
|
||||
#[ast(visit)]
|
||||
#[scope]
|
||||
#[derive(Debug)]
|
||||
|
|
@ -933,6 +1205,7 @@ pub struct TSMethodSignature<'a> {
|
|||
pub scope_id: Cell<Option<ScopeId>>,
|
||||
}
|
||||
|
||||
/// TypeScript Constructor Signature Declaration
|
||||
#[ast(visit)]
|
||||
#[scope]
|
||||
#[derive(Debug)]
|
||||
|
|
@ -1116,6 +1389,19 @@ pub struct TSTypeLiteral<'a> {
|
|||
pub members: Vec<'a, TSSignature<'a>>,
|
||||
}
|
||||
|
||||
/// TypeScript `infer` type
|
||||
///
|
||||
/// Used in a [`TSConditionalType`] to bind a type parameter when some tested type extends a
|
||||
/// desired type.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// type Foo<T> = T extends infer U ? U : never;
|
||||
/// // ^ type_parameter
|
||||
/// ```
|
||||
///
|
||||
/// ## Reference
|
||||
/// * [TypeScript Handbook - Inferring With Conditional Types](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#inferring-within-conditional-types)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -1124,9 +1410,19 @@ pub struct TSTypeLiteral<'a> {
|
|||
pub struct TSInferType<'a> {
|
||||
#[serde(flatten)]
|
||||
pub span: Span,
|
||||
/// The type bound when the
|
||||
pub type_parameter: Box<'a, TSTypeParameter<'a>>,
|
||||
}
|
||||
|
||||
/// Type Query
|
||||
///
|
||||
/// ## Example
|
||||
/// ```ts
|
||||
/// type Foo = typeof Bar;
|
||||
/// ```
|
||||
///
|
||||
/// ## Reference
|
||||
/// * [TypeScript Handbook - Typeof Type Operator](https://www.typescriptlang.org/docs/handbook/2/typeof-types.html)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -1206,6 +1502,14 @@ pub enum TSImportAttributeName<'a> {
|
|||
StringLiteral(StringLiteral<'a>) = 1,
|
||||
}
|
||||
|
||||
/// TypeScript Function Type
|
||||
///
|
||||
/// ## Examples
|
||||
/// ```ts
|
||||
/// // __________ this is the TSFunctionType
|
||||
/// type T = () => void
|
||||
/// // ^^^^ return_type
|
||||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
|
||||
|
|
@ -1214,9 +1518,27 @@ pub enum TSImportAttributeName<'a> {
|
|||
pub struct TSFunctionType<'a> {
|
||||
#[serde(flatten)]
|
||||
pub span: Span,
|
||||
/// `this` parameter
|
||||
///
|
||||
/// ```ts
|
||||
/// type T = (this: string, a: number) => void
|
||||
/// // ^^^^^^^^^^^^
|
||||
/// ```
|
||||
pub this_param: Option<Box<'a, TSThisParameter<'a>>>,
|
||||
/// Function parameters. Akin to [`Function::params`].
|
||||
pub params: Box<'a, FormalParameters<'a>>,
|
||||
/// Return type of the function.
|
||||
/// ```ts
|
||||
/// type T = () => void
|
||||
/// // ^^^^
|
||||
/// ```
|
||||
pub return_type: Box<'a, TSTypeAnnotation<'a>>,
|
||||
/// Generic type parameters
|
||||
///
|
||||
/// ```ts
|
||||
/// type T = <T>(x: T) => T
|
||||
/// // ^
|
||||
/// ```
|
||||
pub type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4300,7 +4300,7 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - id
|
||||
/// - id: Type alias's identifier, e.g. `Foo` in `type Foo = number`.
|
||||
/// - type_parameters
|
||||
/// - type_annotation
|
||||
/// - declare
|
||||
|
|
@ -4341,10 +4341,10 @@ impl<'a> AstBuilder<'a> {
|
|||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - id: The identifier (name) of the interface.
|
||||
/// - extends
|
||||
/// - type_parameters
|
||||
/// - extends: Other interfaces/types this interface extends.
|
||||
/// - type_parameters: Type parameters that get bound to the interface.
|
||||
/// - body
|
||||
/// - declare
|
||||
/// - declare: `true` for `declare interface Foo {}`
|
||||
#[inline]
|
||||
pub fn declaration_ts_interface<T1, T2>(
|
||||
self,
|
||||
|
|
@ -4386,7 +4386,7 @@ impl<'a> AstBuilder<'a> {
|
|||
/// - span: The [`Span`] covering this node
|
||||
/// - id
|
||||
/// - members
|
||||
/// - r#const
|
||||
/// - r#const: `true` for const enums
|
||||
/// - declare
|
||||
#[inline]
|
||||
pub fn declaration_ts_enum(
|
||||
|
|
@ -7805,10 +7805,10 @@ impl<'a> AstBuilder<'a> {
|
|||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - id: The identifier (name) of the interface.
|
||||
/// - extends
|
||||
/// - type_parameters
|
||||
/// - extends: Other interfaces/types this interface extends.
|
||||
/// - type_parameters: Type parameters that get bound to the interface.
|
||||
/// - body
|
||||
/// - declare
|
||||
/// - declare: `true` for `declare interface Foo {}`
|
||||
#[inline]
|
||||
pub fn export_default_declaration_kind_ts_interface_declaration<T1, T2>(
|
||||
self,
|
||||
|
|
@ -7925,7 +7925,7 @@ impl<'a> AstBuilder<'a> {
|
|||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - this_span
|
||||
/// - type_annotation
|
||||
/// - type_annotation: Type type the `this` keyword will have in the function
|
||||
#[inline]
|
||||
pub fn ts_this_parameter<T1>(
|
||||
self,
|
||||
|
|
@ -7950,7 +7950,7 @@ impl<'a> AstBuilder<'a> {
|
|||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - this_span
|
||||
/// - type_annotation
|
||||
/// - type_annotation: Type type the `this` keyword will have in the function
|
||||
#[inline]
|
||||
pub fn alloc_ts_this_parameter<T1>(
|
||||
self,
|
||||
|
|
@ -7972,7 +7972,7 @@ impl<'a> AstBuilder<'a> {
|
|||
/// - span: The [`Span`] covering this node
|
||||
/// - id
|
||||
/// - members
|
||||
/// - r#const
|
||||
/// - r#const: `true` for const enums
|
||||
/// - declare
|
||||
#[inline]
|
||||
pub fn ts_enum_declaration(
|
||||
|
|
@ -7994,7 +7994,7 @@ impl<'a> AstBuilder<'a> {
|
|||
/// - span: The [`Span`] covering this node
|
||||
/// - id
|
||||
/// - members
|
||||
/// - r#const
|
||||
/// - r#const: `true` for const enums
|
||||
/// - declare
|
||||
#[inline]
|
||||
pub fn alloc_ts_enum_declaration(
|
||||
|
|
@ -8168,7 +8168,7 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: starts at the `:` token and ends at the end of the type annotation
|
||||
/// - type_annotation
|
||||
/// - type_annotation: The actual type in the annotation
|
||||
#[inline]
|
||||
pub fn ts_type_annotation(
|
||||
self,
|
||||
|
|
@ -8184,7 +8184,7 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: starts at the `:` token and ends at the end of the type annotation
|
||||
/// - type_annotation
|
||||
/// - type_annotation: The actual type in the annotation
|
||||
#[inline]
|
||||
pub fn alloc_ts_type_annotation(
|
||||
self,
|
||||
|
|
@ -8717,10 +8717,10 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - check_type
|
||||
/// - extends_type
|
||||
/// - true_type
|
||||
/// - false_type
|
||||
/// - check_type: The type before `extends` in the test expression.
|
||||
/// - extends_type: The type `check_type` is being tested against.
|
||||
/// - true_type: The type evaluated to if the test is true.
|
||||
/// - false_type: The type evaluated to if the test is false.
|
||||
#[inline]
|
||||
pub fn ts_type_conditional_type(
|
||||
self,
|
||||
|
|
@ -8796,10 +8796,10 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - this_param
|
||||
/// - params
|
||||
/// - return_type
|
||||
/// - type_parameters
|
||||
/// - this_param: `this` parameter
|
||||
/// - params: Function parameters. Akin to [`Function::params`].
|
||||
/// - return_type: Return type of the function.
|
||||
/// - type_parameters: Generic type parameters
|
||||
#[inline]
|
||||
pub fn ts_type_function_type<T1, T2, T3, T4>(
|
||||
self,
|
||||
|
|
@ -8914,7 +8914,7 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - type_parameter
|
||||
/// - type_parameter: The type bound when the
|
||||
#[inline]
|
||||
pub fn ts_type_infer_type<T1>(self, span: Span, type_parameter: T1) -> TSType<'a>
|
||||
where
|
||||
|
|
@ -9180,7 +9180,7 @@ impl<'a> AstBuilder<'a> {
|
|||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - operator
|
||||
/// - type_annotation
|
||||
/// - type_annotation: The type being operated on
|
||||
#[inline]
|
||||
pub fn ts_type_type_operator(
|
||||
self,
|
||||
|
|
@ -9311,7 +9311,7 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - types
|
||||
/// - types: The types in the union.
|
||||
#[inline]
|
||||
pub fn ts_type_union_type(self, span: Span, types: Vec<'a, TSType<'a>>) -> TSType<'a> {
|
||||
TSType::TSUnionType(self.alloc(self.ts_union_type(span, types)))
|
||||
|
|
@ -9435,10 +9435,10 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - check_type
|
||||
/// - extends_type
|
||||
/// - true_type
|
||||
/// - false_type
|
||||
/// - check_type: The type before `extends` in the test expression.
|
||||
/// - extends_type: The type `check_type` is being tested against.
|
||||
/// - true_type: The type evaluated to if the test is true.
|
||||
/// - false_type: The type evaluated to if the test is false.
|
||||
#[inline]
|
||||
pub fn ts_conditional_type(
|
||||
self,
|
||||
|
|
@ -9464,10 +9464,10 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - check_type
|
||||
/// - extends_type
|
||||
/// - true_type
|
||||
/// - false_type
|
||||
/// - check_type: The type before `extends` in the test expression.
|
||||
/// - extends_type: The type `check_type` is being tested against.
|
||||
/// - true_type: The type evaluated to if the test is true.
|
||||
/// - false_type: The type evaluated to if the test is false.
|
||||
#[inline]
|
||||
pub fn alloc_ts_conditional_type(
|
||||
self,
|
||||
|
|
@ -9489,7 +9489,7 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - types
|
||||
/// - types: The types in the union.
|
||||
#[inline]
|
||||
pub fn ts_union_type(self, span: Span, types: Vec<'a, TSType<'a>>) -> TSUnionType<'a> {
|
||||
TSUnionType { span, types }
|
||||
|
|
@ -9501,7 +9501,7 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - types
|
||||
/// - types: The types in the union.
|
||||
#[inline]
|
||||
pub fn alloc_ts_union_type(
|
||||
self,
|
||||
|
|
@ -9582,7 +9582,7 @@ impl<'a> AstBuilder<'a> {
|
|||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - operator
|
||||
/// - type_annotation
|
||||
/// - type_annotation: The type being operated on
|
||||
#[inline]
|
||||
pub fn ts_type_operator(
|
||||
self,
|
||||
|
|
@ -9600,7 +9600,7 @@ impl<'a> AstBuilder<'a> {
|
|||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - operator
|
||||
/// - type_annotation
|
||||
/// - type_annotation: The type being operated on
|
||||
#[inline]
|
||||
pub fn alloc_ts_type_operator(
|
||||
self,
|
||||
|
|
@ -10337,12 +10337,12 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - name
|
||||
/// - constraint
|
||||
/// - default
|
||||
/// - r#in
|
||||
/// - out
|
||||
/// - r#const
|
||||
/// - name: The name of the parameter, e.g. `T` in `type Foo<T> = ...`.
|
||||
/// - constraint: Constrains what types can be passed to the type parameter.
|
||||
/// - default: Default value of the type parameter if no type is provided when using the type.
|
||||
/// - r#in: Was an `in` modifier keyword present?
|
||||
/// - out: Was an `out` modifier keyword present?
|
||||
/// - r#const: Was a `const` modifier keyword present?
|
||||
#[inline]
|
||||
pub fn ts_type_parameter(
|
||||
self,
|
||||
|
|
@ -10363,12 +10363,12 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - name
|
||||
/// - constraint
|
||||
/// - default
|
||||
/// - r#in
|
||||
/// - out
|
||||
/// - r#const
|
||||
/// - name: The name of the parameter, e.g. `T` in `type Foo<T> = ...`.
|
||||
/// - constraint: Constrains what types can be passed to the type parameter.
|
||||
/// - default: Default value of the type parameter if no type is provided when using the type.
|
||||
/// - r#in: Was an `in` modifier keyword present?
|
||||
/// - out: Was an `out` modifier keyword present?
|
||||
/// - r#const: Was a `const` modifier keyword present?
|
||||
#[inline]
|
||||
pub fn alloc_ts_type_parameter(
|
||||
self,
|
||||
|
|
@ -10424,7 +10424,7 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - id
|
||||
/// - id: Type alias's identifier, e.g. `Foo` in `type Foo = number`.
|
||||
/// - type_parameters
|
||||
/// - type_annotation
|
||||
/// - declare
|
||||
|
|
@ -10456,7 +10456,7 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - id
|
||||
/// - id: Type alias's identifier, e.g. `Foo` in `type Foo = number`.
|
||||
/// - type_parameters
|
||||
/// - type_annotation
|
||||
/// - declare
|
||||
|
|
@ -10531,10 +10531,10 @@ impl<'a> AstBuilder<'a> {
|
|||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - id: The identifier (name) of the interface.
|
||||
/// - extends
|
||||
/// - type_parameters
|
||||
/// - extends: Other interfaces/types this interface extends.
|
||||
/// - type_parameters: Type parameters that get bound to the interface.
|
||||
/// - body
|
||||
/// - declare
|
||||
/// - declare: `true` for `declare interface Foo {}`
|
||||
#[inline]
|
||||
pub fn ts_interface_declaration<T1, T2>(
|
||||
self,
|
||||
|
|
@ -10567,10 +10567,10 @@ impl<'a> AstBuilder<'a> {
|
|||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - id: The identifier (name) of the interface.
|
||||
/// - extends
|
||||
/// - type_parameters
|
||||
/// - extends: Other interfaces/types this interface extends.
|
||||
/// - type_parameters: Type parameters that get bound to the interface.
|
||||
/// - body
|
||||
/// - declare
|
||||
/// - declare: `true` for `declare interface Foo {}`
|
||||
#[inline]
|
||||
pub fn alloc_ts_interface_declaration<T1, T2>(
|
||||
self,
|
||||
|
|
@ -11619,7 +11619,7 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - type_parameter
|
||||
/// - type_parameter: The type bound when the
|
||||
#[inline]
|
||||
pub fn ts_infer_type<T1>(self, span: Span, type_parameter: T1) -> TSInferType<'a>
|
||||
where
|
||||
|
|
@ -11634,7 +11634,7 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - type_parameter
|
||||
/// - type_parameter: The type bound when the
|
||||
#[inline]
|
||||
pub fn alloc_ts_infer_type<T1>(self, span: Span, type_parameter: T1) -> Box<'a, TSInferType<'a>>
|
||||
where
|
||||
|
|
@ -11946,10 +11946,10 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - this_param
|
||||
/// - params
|
||||
/// - return_type
|
||||
/// - type_parameters
|
||||
/// - this_param: `this` parameter
|
||||
/// - params: Function parameters. Akin to [`Function::params`].
|
||||
/// - return_type: Return type of the function.
|
||||
/// - type_parameters: Generic type parameters
|
||||
#[inline]
|
||||
pub fn ts_function_type<T1, T2, T3, T4>(
|
||||
self,
|
||||
|
|
@ -11980,10 +11980,10 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - this_param
|
||||
/// - params
|
||||
/// - return_type
|
||||
/// - type_parameters
|
||||
/// - this_param: `this` parameter
|
||||
/// - params: Function parameters. Akin to [`Function::params`].
|
||||
/// - return_type: Return type of the function.
|
||||
/// - type_parameters: Generic type parameters
|
||||
#[inline]
|
||||
pub fn alloc_ts_function_type<T1, T2, T3, T4>(
|
||||
self,
|
||||
|
|
|
|||
Loading…
Reference in a new issue