import { Type } from "https://dotland.deno.dev/x/ts_morph@22.0.0/mod.ts";
Methods
Gets the alias symbol if it exists, or throws.
Gets the array element type or returns undefined if it doesn't exist (ex. for T[]
it would be T
).
Gets the array element type or throws if it doesn't exist (ex. for T[]
it would be T
).
Gets the base type of a literal type.
For example, for a number literal type it will return the number type.
Gets the constraint or returns undefined if it doesn't exist.
Gets the constraint or throws if it doesn't exist.
Gets the default type or returns undefined if it doesn't exist.
Gets the default type or throws if it doesn't exist.
Gets the intersection types (ex. for T & U
it returns the array [T, U]
).
Gets the fresh type of the literal or returns undefined if this is not a literal type.
Note: I have no idea what this means. Please help contribute to these js docs if you know.
Gets the fresh type of the literal or throws if this is not a literal type.
Note: I have no idea what this means. Please help contribute to these js docs if you know.
Gets the regular type of the literal or returns undefined if this is not a literal type.
Note: I have no idea what this means. Please help contribute to these js docs if you know.
Gets the regular type of the literal or throws if this is not a literal type.
Note: I have no idea what this means. Please help contribute to these js docs if you know.
Gets the value of a literal or returns undefined if this is not a literal type.
Gets the value of the literal or throws if this is not a literal type.
Gets the object flags.
Gets a property or returns undefined if it does not exist.
Gets a property or returns undefined if it does not exist.
Gets a property or throws if it doesn't exist.
Returns the generic type when the type is a type reference, returns itself when it's already a generic type, or otherwise returns undefined.
For example:
- Given type reference
Promise<string>
returnsPromise<T>
. - Given generic type
Promise<T>
returns the samePromise<T>
. - Given
string
returnsundefined
.
Returns the generic type when the type is a type reference, returns itself when it's already a generic type, or otherwise throws an error.
For example:
- Given type reference
Promise<string>
returnsPromise<T>
. - Given generic type
Promise<T>
returns the samePromise<T>
. - Given
string
throws an error.
Gets if this is a union or intersection type.