ToTsType

Trait ToTsType 

Source
pub trait ToTsType {
    // Required method
    fn to_ts_type(&self) -> TsType;
}
Expand description

Converts common Rust values into SWC TsType nodes.

This enables ergonomic interpolation in template literals where a type annotation is expected.

Required Methods§

Implementations on Foreign Types§

Source§

impl ToTsType for &bool

Available on crate feature swc only.

Convert a reference to bool to a TsType.

Source§

impl ToTsType for &str

Available on crate feature swc only.
Source§

impl ToTsType for &String

Available on crate feature swc only.

Convert a reference to String to a TsType.

Source§

impl ToTsType for bool

Available on crate feature swc only.

Convert a bool to a TsLiteralType (true or false literal type).

Source§

impl ToTsType for str

Available on crate feature swc only.
Source§

impl ToTsType for Box<TsType>

Available on crate feature swc only.
Source§

impl ToTsType for String

Available on crate feature swc only.

Convert a string to a TsTypeRef (type reference by name).

Implementors§

Source§

impl ToTsType for &Ident

Available on crate feature swc only.

Convert a reference to Ident to a TsTypeRef.

Source§

impl ToTsType for Expr

Available on crate feature swc only.

Convert an Expr to a TsType. Only works for identifier expressions.

Source§

impl ToTsType for TsType

Available on crate feature swc only.
Source§

impl ToTsType for Ident

Available on crate feature swc only.

Convert an Ident to a TsTypeRef.