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§
fn to_ts_type(self) -> TsType
Implementations on Foreign Types§
Source§impl ToTsType for &bool
Available on crate feature swc only.
impl ToTsType for &bool
Available on crate feature
swc only.fn to_ts_type(self) -> TsType
Source§impl ToTsType for &str
Available on crate feature swc only.
impl ToTsType for &str
Available on crate feature
swc only.fn to_ts_type(self) -> TsType
Source§impl ToTsType for &String
Available on crate feature swc only.
impl ToTsType for &String
Available on crate feature
swc only.fn to_ts_type(self) -> TsType
Source§impl ToTsType for bool
Available on crate feature swc only.Convert a bool to a TsLiteralType (true or false literal type).
impl ToTsType for bool
Available on crate feature
swc only.Convert a bool to a TsLiteralType (true or false literal type).
fn to_ts_type(self) -> TsType
Source§impl ToTsType for Box<TsType>
Available on crate feature swc only.
impl ToTsType for Box<TsType>
Available on crate feature
swc only.fn to_ts_type(self) -> TsType
Source§impl ToTsType for String
Available on crate feature swc only.Convert a string to a TsTypeRef (type reference by name).
impl ToTsType for String
Available on crate feature
swc only.Convert a string to a TsTypeRef (type reference by name).
fn to_ts_type(self) -> TsType
Implementors§
impl ToTsType for &Expr
Available on crate feature
swc only.impl ToTsType for &TsType
Available on crate feature
swc only.impl ToTsType for &Ident
Available on crate feature
swc only.impl ToTsType for Expr
Available on crate feature
swc only.Convert an Expr to a TsType. Only works for identifier expressions.
impl ToTsType for TsType
Available on crate feature
swc only.impl ToTsType for Ident
Available on crate feature
swc only.Convert an Ident to a TsTypeRef.