Skip to main content

TypeAnnotation

Enum TypeAnnotation 

Source
pub enum TypeAnnotation {
Show 33 variants StringTypeAnnotation, NumberTypeAnnotation, BooleanTypeAnnotation, VoidTypeAnnotation, MixedTypeAnnotation, AnyTypeAnnotation, EmptyTypeAnnotation, NullLiteralTypeAnnotation, BigIntTypeAnnotation, SymbolTypeAnnotation, StringLiteralTypeAnnotation { value: String, }, NumberLiteralTypeAnnotation { value: f64, }, BooleanLiteralTypeAnnotation { value: bool, }, BigIntLiteralTypeAnnotation { value: Option<Value>, }, NullableTypeAnnotation { type_annotation: Box<TypeAnnotation>, }, ObjectTypeAnnotation { properties: Vec<ObjectMember>, indexers: Vec<ObjectTypeIndexer>, call_properties: Vec<ObjectTypeCallProperty>, internal_slots: Vec<ObjectTypeInternalSlot>, exact: bool, }, UnionTypeAnnotation { types: Vec<TypeAnnotation>, }, IntersectionTypeAnnotation { types: Vec<TypeAnnotation>, }, GenericTypeAnnotation { id: TypeIdentifier, type_parameters: Option<TypeParameterInstantiation>, }, TupleTypeAnnotation { element_types: Vec<TypeAnnotation>, }, ArrayTypeAnnotation { element_type: Box<TypeAnnotation>, }, TypeofTypeAnnotation { argument: Box<TypeAnnotation>, }, FunctionTypeAnnotation { params: Vec<FunctionTypeParam>, return_type: Box<TypeAnnotation>, rest: Option<Box<FunctionTypeParam>>, type_parameters: Option<TypeParameterDeclaration>, this_constraint: Option<Box<FunctionTypeParam>>, }, InterfaceTypeAnnotation { extends: Vec<InterfaceExtends>, body: Box<TypeAnnotation>, }, ExistsTypeAnnotation, IndexedAccessType { object_type: Box<TypeAnnotation>, index_type: Box<TypeAnnotation>, }, OptionalIndexedAccessType { object_type: Box<TypeAnnotation>, index_type: Box<TypeAnnotation>, optional: bool, }, KeyofTypeAnnotation { argument: Box<TypeAnnotation>, }, ConditionalTypeAnnotation { check_type: Box<TypeAnnotation>, extends_type: Box<TypeAnnotation>, true_type: Box<TypeAnnotation>, false_type: Box<TypeAnnotation>, }, InferTypeAnnotation { type_parameter: Option<Value>, }, TypeOperator { operator: Option<String>, type_annotation: Box<TypeAnnotation>, }, ComponentTypeAnnotation { params: Vec<Value>, rest: Option<Value>, type_parameters: Option<TypeParameterDeclaration>, renders_type: Option<Box<TypeAnnotation>>, }, Other,
}
Expand description

A Flow type annotation node.

Variants§

§

StringTypeAnnotation

§

NumberTypeAnnotation

§

BooleanTypeAnnotation

§

VoidTypeAnnotation

§

MixedTypeAnnotation

§

AnyTypeAnnotation

§

EmptyTypeAnnotation

§

NullLiteralTypeAnnotation

§

BigIntTypeAnnotation

§

SymbolTypeAnnotation

§

StringLiteralTypeAnnotation

Fields

§value: String
§

NumberLiteralTypeAnnotation

Fields

§value: f64
§

BooleanLiteralTypeAnnotation

Fields

§value: bool
§

BigIntLiteralTypeAnnotation

Fields

§value: Option<Value>
§

NullableTypeAnnotation

Fields

§type_annotation: Box<TypeAnnotation>
§

ObjectTypeAnnotation

Fields

§properties: Vec<ObjectMember>
§call_properties: Vec<ObjectTypeCallProperty>
§internal_slots: Vec<ObjectTypeInternalSlot>
§exact: bool
§

UnionTypeAnnotation

Fields

§

IntersectionTypeAnnotation

Fields

§

GenericTypeAnnotation

§

TupleTypeAnnotation

Fields

§element_types: Vec<TypeAnnotation>
§

ArrayTypeAnnotation

Fields

§element_type: Box<TypeAnnotation>
§

TypeofTypeAnnotation

Fields

§

FunctionTypeAnnotation

§

InterfaceTypeAnnotation

§

ExistsTypeAnnotation

§

IndexedAccessType

Fields

§object_type: Box<TypeAnnotation>
§index_type: Box<TypeAnnotation>
§

OptionalIndexedAccessType

Fields

§object_type: Box<TypeAnnotation>
§index_type: Box<TypeAnnotation>
§optional: bool
§

KeyofTypeAnnotation

Fields

§

ConditionalTypeAnnotation

Fields

§check_type: Box<TypeAnnotation>
§extends_type: Box<TypeAnnotation>
§true_type: Box<TypeAnnotation>
§false_type: Box<TypeAnnotation>
§

InferTypeAnnotation

Fields

§type_parameter: Option<Value>
§

TypeOperator

Fields

§operator: Option<String>
§type_annotation: Box<TypeAnnotation>
§

ComponentTypeAnnotation

Fields

§params: Vec<Value>
§renders_type: Option<Box<TypeAnnotation>>
§

Other

Implementations§

Source§

impl TypeAnnotation

Source

pub fn type_name(&self) -> &'static str

Short type tag for assertions (e.g. "StringTypeAnnotation").

Trait Implementations§

Source§

impl Clone for TypeAnnotation

Source§

fn clone(&self) -> TypeAnnotation

Returns a duplicate 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 TypeAnnotation

Source§

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

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

impl<'de> Deserialize<'de> for TypeAnnotation

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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,

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,