import { TypePredicateNode } from "https://dotland.deno.dev/x/ts_morph@18.0.0/mod.ts";
A type predicate node which says the specified parameter name is a specific type if the function returns true.
Examples:
param is string
indeclare function isString(param: unknown): param is string;
.asserts condition
indeclare function assert(condition: any): asserts condition;
.
Methods
getAssertsModifierOrThrow(message?: string | (() => string)): Node<ts.AssertsKeyword>
Gets the asserts modifier if it exists or throws otherwise.
getParent(): NodeParentType<ts.TypePredicateNode>
getParentOrThrow(message?: string | (() => string)): NonNullable<NodeParentType<ts.TypePredicateNode>>
getTypeNode(): TypeNode | undefined
Gets the type name if it exists or returns undefined when it asserts a condition.
getTypeNodeOrThrow(message?: string | (() => string)): TypeNode
Gets the type name if it exists or throws when it asserts a condition.
hasAssertsModifier(): boolean
Gets if the type predicate has an asserts
modifier (ex. asserts condition
).