pub enum AnyTsType {
Show 35 variants TsAnyType(TsAnyType), TsArrayType(TsArrayType), TsBigintLiteralType(TsBigintLiteralType), TsBigintType(TsBigintType), TsBogusType(TsBogusType), TsBooleanLiteralType(TsBooleanLiteralType), TsBooleanType(TsBooleanType), TsConditionalType(TsConditionalType), TsConstructorType(TsConstructorType), TsFunctionType(TsFunctionType), TsImportType(TsImportType), TsIndexedAccessType(TsIndexedAccessType), TsInferType(TsInferType), TsIntersectionType(TsIntersectionType), TsMappedType(TsMappedType), TsNeverType(TsNeverType), TsNonPrimitiveType(TsNonPrimitiveType), TsNullLiteralType(TsNullLiteralType), TsNumberLiteralType(TsNumberLiteralType), TsNumberType(TsNumberType), TsObjectType(TsObjectType), TsParenthesizedType(TsParenthesizedType), TsReferenceType(TsReferenceType), TsStringLiteralType(TsStringLiteralType), TsStringType(TsStringType), TsSymbolType(TsSymbolType), TsTemplateLiteralType(TsTemplateLiteralType), TsThisType(TsThisType), TsTupleType(TsTupleType), TsTypeOperatorType(TsTypeOperatorType), TsTypeofType(TsTypeofType), TsUndefinedType(TsUndefinedType), TsUnionType(TsUnionType), TsUnknownType(TsUnknownType), TsVoidType(TsVoidType),
}

Variants§

§

TsAnyType(TsAnyType)

§

TsArrayType(TsArrayType)

§

TsBigintLiteralType(TsBigintLiteralType)

§

TsBigintType(TsBigintType)

§

TsBogusType(TsBogusType)

§

TsBooleanLiteralType(TsBooleanLiteralType)

§

TsBooleanType(TsBooleanType)

§

TsConditionalType(TsConditionalType)

§

TsConstructorType(TsConstructorType)

§

TsFunctionType(TsFunctionType)

§

TsImportType(TsImportType)

§

TsIndexedAccessType(TsIndexedAccessType)

§

TsInferType(TsInferType)

§

TsIntersectionType(TsIntersectionType)

§

TsMappedType(TsMappedType)

§

TsNeverType(TsNeverType)

§

TsNonPrimitiveType(TsNonPrimitiveType)

§

TsNullLiteralType(TsNullLiteralType)

§

TsNumberLiteralType(TsNumberLiteralType)

§

TsNumberType(TsNumberType)

§

TsObjectType(TsObjectType)

§

TsParenthesizedType(TsParenthesizedType)

§

TsReferenceType(TsReferenceType)

§

TsStringLiteralType(TsStringLiteralType)

§

TsStringType(TsStringType)

§

TsSymbolType(TsSymbolType)

§

TsTemplateLiteralType(TsTemplateLiteralType)

§

TsThisType(TsThisType)

§

TsTupleType(TsTupleType)

§

TsTypeOperatorType(TsTypeOperatorType)

§

TsTypeofType(TsTypeofType)

§

TsUndefinedType(TsUndefinedType)

§

TsUnionType(TsUnionType)

§

TsUnknownType(TsUnknownType)

§

TsVoidType(TsVoidType)

Implementations§

source§

impl AnyTsType

source

pub fn as_ts_any_type(&self) -> Option<&TsAnyType>

source

pub fn as_ts_array_type(&self) -> Option<&TsArrayType>

source

pub fn as_ts_bigint_literal_type(&self) -> Option<&TsBigintLiteralType>

source

pub fn as_ts_bigint_type(&self) -> Option<&TsBigintType>

source

pub fn as_ts_bogus_type(&self) -> Option<&TsBogusType>

source

pub fn as_ts_boolean_literal_type(&self) -> Option<&TsBooleanLiteralType>

source

pub fn as_ts_boolean_type(&self) -> Option<&TsBooleanType>

source

pub fn as_ts_conditional_type(&self) -> Option<&TsConditionalType>

source

pub fn as_ts_constructor_type(&self) -> Option<&TsConstructorType>

source

pub fn as_ts_function_type(&self) -> Option<&TsFunctionType>

source

pub fn as_ts_import_type(&self) -> Option<&TsImportType>

source

pub fn as_ts_indexed_access_type(&self) -> Option<&TsIndexedAccessType>

source

pub fn as_ts_infer_type(&self) -> Option<&TsInferType>

source

pub fn as_ts_intersection_type(&self) -> Option<&TsIntersectionType>

source

pub fn as_ts_mapped_type(&self) -> Option<&TsMappedType>

source

pub fn as_ts_never_type(&self) -> Option<&TsNeverType>

source

pub fn as_ts_non_primitive_type(&self) -> Option<&TsNonPrimitiveType>

source

pub fn as_ts_null_literal_type(&self) -> Option<&TsNullLiteralType>

source

pub fn as_ts_number_literal_type(&self) -> Option<&TsNumberLiteralType>

source

pub fn as_ts_number_type(&self) -> Option<&TsNumberType>

source

pub fn as_ts_object_type(&self) -> Option<&TsObjectType>

source

pub fn as_ts_parenthesized_type(&self) -> Option<&TsParenthesizedType>

source

pub fn as_ts_reference_type(&self) -> Option<&TsReferenceType>

source

pub fn as_ts_string_literal_type(&self) -> Option<&TsStringLiteralType>

source

pub fn as_ts_string_type(&self) -> Option<&TsStringType>

source

pub fn as_ts_symbol_type(&self) -> Option<&TsSymbolType>

source

pub fn as_ts_template_literal_type(&self) -> Option<&TsTemplateLiteralType>

source

pub fn as_ts_this_type(&self) -> Option<&TsThisType>

source

pub fn as_ts_tuple_type(&self) -> Option<&TsTupleType>

source

pub fn as_ts_type_operator_type(&self) -> Option<&TsTypeOperatorType>

source

pub fn as_ts_typeof_type(&self) -> Option<&TsTypeofType>

source

pub fn as_ts_undefined_type(&self) -> Option<&TsUndefinedType>

source

pub fn as_ts_union_type(&self) -> Option<&TsUnionType>

source

pub fn as_ts_unknown_type(&self) -> Option<&TsUnknownType>

source

pub fn as_ts_void_type(&self) -> Option<&TsVoidType>

source§

impl AnyTsType

source

pub fn omit_parentheses(self) -> AnyTsType

Try to extract non TsParenthesizedType from AnyTsType

source

pub fn is_literal_type(&self) -> bool

Returns true if self is a literal type.

§Examples
use biome_js_factory::make;
use biome_js_syntax::T;
use biome_js_syntax::AnyTsType;

let boolean_literal = make::ts_boolean_literal_type(make::token(T![true]));
let bigint_literal = make::ts_bigint_literal_type(make::js_number_literal("1n")).build();
let null_literal = make::ts_null_literal_type(make::token(T![null]));
let number_literal = make::ts_number_literal_type(make::js_number_literal("1")).build();
let string_literal = make::ts_string_literal_type(make::js_string_literal("s"));
let undefined = make::ts_undefined_type(make::token(T![undefined]));

assert!(AnyTsType::TsBooleanLiteralType(boolean_literal).is_literal_type());
assert!(AnyTsType::TsBigintLiteralType(bigint_literal).is_literal_type());
assert!(AnyTsType::TsNullLiteralType(null_literal).is_literal_type());
assert!(AnyTsType::TsNumberLiteralType(number_literal).is_literal_type());
assert!(AnyTsType::TsStringLiteralType(string_literal).is_literal_type());
assert!(AnyTsType::TsUndefinedType(undefined).is_literal_type());
source

pub fn is_primitive_type(&self) -> bool

Returns true if self is a primitive type.

§Examples
use biome_js_factory::make;
use biome_js_syntax::T;
use biome_js_syntax::AnyTsType;

let boolean = make::ts_boolean_type(make::token(T![boolean]));
let bigint = make::ts_bigint_type(make::token(T![bigint]));
let number = make::ts_number_type(make::token(T![number]));
let string = make::ts_string_type(make::token(T![string]));

assert!(AnyTsType::TsBooleanType(boolean).is_primitive_type());
assert!(AnyTsType::TsBigintType(bigint).is_primitive_type());
assert!(AnyTsType::TsNumberType(number).is_primitive_type());
assert!(AnyTsType::TsStringType(string).is_primitive_type());
source

pub fn in_conditional_true_type(&self) -> bool

Checks if self stands as the true_type of a conditional type in Typescript.

§Examples
use biome_js_factory::make;
use biome_js_syntax::T;
use biome_js_syntax::AnyTsType;

let check_type = AnyTsType::TsNumberType(make::ts_number_type(make::token(T![number])));
let extends_type = AnyTsType::TsNumberType(make::ts_number_type(make::token(T![number])));
let true_type = AnyTsType::TsNumberType(make::ts_number_type(make::token(T![number])));
let false_type = AnyTsType::TsNumberType(make::ts_number_type(make::token(T![number])));

let conditional = make::ts_conditional_type(
    check_type,
    make::token(T![extends]),
    extends_type,
    make::token(T![?]),
    true_type,
    make::token(T![:]),
    false_type,
);

assert!(!conditional.check_type().unwrap().in_conditional_true_type());
assert!(!conditional.extends_type().unwrap().in_conditional_true_type());
assert!(conditional.true_type().unwrap().in_conditional_true_type());
assert!(!conditional.false_type().unwrap().in_conditional_true_type());

Trait Implementations§

source§

impl AstNode for AnyTsType

§

type Language = JsLanguage

source§

const KIND_SET: SyntaxKindSet<Language> = _

source§

fn can_cast(kind: SyntaxKind) -> bool

Returns true if a node with the given kind can be cased to this AST node.
source§

fn cast(syntax: SyntaxNode) -> Option<Self>

Tries to cast the passed syntax node to this AST node. Read more
source§

fn syntax(&self) -> &SyntaxNode

Returns the underlying syntax node.
source§

fn into_syntax(self) -> SyntaxNode

Returns the underlying syntax node.
source§

fn cast_ref(syntax: &SyntaxNode<Self::Language>) -> Option<Self>
where Self: Sized,

Takes a reference of a syntax node and tries to cast it to this AST node. Read more
source§

fn try_cast( syntax: SyntaxNode<Self::Language> ) -> Result<Self, SyntaxNode<Self::Language>>

Tries to cast the passed syntax node to this AST node. Read more
source§

fn try_cast_node<T>(node: T) -> Result<Self, T>
where T: AstNode<Language = Self::Language>,

Tries to cast the AST node into this node. Read more
source§

fn unwrap_cast(syntax: SyntaxNode<Self::Language>) -> Self
where Self: Sized,

Cast this node to this AST node Read more
source§

fn text(&self) -> String

Returns the string representation of this node without the leading and trailing trivia
source§

fn range(&self) -> TextRange

source§

fn clone_subtree(&self) -> Self
where Self: Sized,

source§

fn parent<T>(&self) -> Option<T>
where T: AstNode<Language = Self::Language>,

source§

fn with_leading_trivia_pieces<I>(self, trivia: I) -> Option<Self>

Return a new version of this node with the leading trivia of its first token replaced with trivia.
source§

fn with_trailing_trivia_pieces<I>(self, trivia: I) -> Option<Self>

Return a new version of this node with the trailing trivia of its last token replaced with trivia.
source§

fn prepend_trivia_pieces<I>(self, trivia: I) -> Option<Self>

source§

fn append_trivia_pieces<I>(self, trivia: I) -> Option<Self>

source§

fn trim_trivia(self) -> Option<Self>

Return a new version of this node without leading and trailing newlines and whitespaces.
source§

fn trim_leading_trivia(self) -> Option<Self>

Return a new version of this node without leading newlines and whitespaces.
source§

fn trim_trailing_trivia(self) -> Option<Self>

Return a new version of this node without trailing newlines and whitespaces.
source§

impl Clone for AnyTsType

source§

fn clone(&self) -> AnyTsType

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for AnyTsType

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for AnyTsType

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<AnyTsType> for JsSyntaxElement

source§

fn from(n: AnyTsType) -> SyntaxElement

Converts to this type from the input type.
source§

impl From<AnyTsType> for JsSyntaxNode

source§

fn from(n: AnyTsType) -> SyntaxNode

Converts to this type from the input type.
source§

impl From<TsAnyType> for AnyTsType

source§

fn from(node: TsAnyType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsArrayType> for AnyTsType

source§

fn from(node: TsArrayType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsBigintLiteralType> for AnyTsType

source§

fn from(node: TsBigintLiteralType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsBigintType> for AnyTsType

source§

fn from(node: TsBigintType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsBogusType> for AnyTsType

source§

fn from(node: TsBogusType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsBooleanLiteralType> for AnyTsType

source§

fn from(node: TsBooleanLiteralType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsBooleanType> for AnyTsType

source§

fn from(node: TsBooleanType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsConditionalType> for AnyTsType

source§

fn from(node: TsConditionalType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsConstructorType> for AnyTsType

source§

fn from(node: TsConstructorType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsFunctionType> for AnyTsType

source§

fn from(node: TsFunctionType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsImportType> for AnyTsType

source§

fn from(node: TsImportType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsIndexedAccessType> for AnyTsType

source§

fn from(node: TsIndexedAccessType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsInferType> for AnyTsType

source§

fn from(node: TsInferType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsIntersectionType> for AnyTsType

source§

fn from(node: TsIntersectionType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsMappedType> for AnyTsType

source§

fn from(node: TsMappedType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsNeverType> for AnyTsType

source§

fn from(node: TsNeverType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsNonPrimitiveType> for AnyTsType

source§

fn from(node: TsNonPrimitiveType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsNullLiteralType> for AnyTsType

source§

fn from(node: TsNullLiteralType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsNumberLiteralType> for AnyTsType

source§

fn from(node: TsNumberLiteralType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsNumberType> for AnyTsType

source§

fn from(node: TsNumberType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsObjectType> for AnyTsType

source§

fn from(node: TsObjectType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsParenthesizedType> for AnyTsType

source§

fn from(node: TsParenthesizedType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsReferenceType> for AnyTsType

source§

fn from(node: TsReferenceType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsStringLiteralType> for AnyTsType

source§

fn from(node: TsStringLiteralType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsStringType> for AnyTsType

source§

fn from(node: TsStringType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsSymbolType> for AnyTsType

source§

fn from(node: TsSymbolType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsTemplateLiteralType> for AnyTsType

source§

fn from(node: TsTemplateLiteralType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsThisType> for AnyTsType

source§

fn from(node: TsThisType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsTupleType> for AnyTsType

source§

fn from(node: TsTupleType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsTypeOperatorType> for AnyTsType

source§

fn from(node: TsTypeOperatorType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsTypeofType> for AnyTsType

source§

fn from(node: TsTypeofType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsUndefinedType> for AnyTsType

source§

fn from(node: TsUndefinedType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsUnionType> for AnyTsType

source§

fn from(node: TsUnionType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsUnknownType> for AnyTsType

source§

fn from(node: TsUnknownType) -> AnyTsType

Converts to this type from the input type.
source§

impl From<TsVoidType> for AnyTsType

source§

fn from(node: TsVoidType) -> AnyTsType

Converts to this type from the input type.
source§

impl Hash for AnyTsType

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for AnyTsType

source§

fn eq(&self, other: &AnyTsType) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for AnyTsType

source§

impl StructuralPartialEq for AnyTsType

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AstNodeExt for T
where T: AstNode,

source§

fn replace_node_discard_trivia<N>(self, prev_node: N, next_node: N) -> Option<T>
where N: AstNode<Language = <T as AstNode>::Language>,

Return a new version of this node with the node prev_node replaced with next_node Read more
source§

fn replace_node<N>(self, prev_node: N, next_node: N) -> Option<T>
where N: AstNode<Language = <T as AstNode>::Language>,

Return a new version of this node with the node prev_node replaced with next_node, transfering the leading and trailing trivia of prev_node to next_node Read more
source§

fn replace_token_discard_trivia( self, prev_token: SyntaxToken<<T as AstNode>::Language>, next_token: SyntaxToken<<T as AstNode>::Language> ) -> Option<T>

Return a new version of this node with the token prev_token replaced with next_token Read more
source§

fn replace_token( self, prev_token: SyntaxToken<<T as AstNode>::Language>, next_token: SyntaxToken<<T as AstNode>::Language> ) -> Option<T>

Return a new version of this node with the token prev_token replaced with next_token, transfering the leading and trailing trivia of prev_token to next_token Read more
source§

fn detach(self) -> T

source§

impl<L, T> BatchMutationExt<L> for T
where L: Language, T: AstNode<Language = L>,

source§

fn begin(self) -> BatchMutation<L>

It starts a BatchMutation
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more