Skip to content

OverloadDecl

OverloadDecl contains the definition of a single overload id with a specific signature, and an optional implementation.

new OverloadDecl(idValue, argTypesValue, resultTypeValue, memberFunction, options?): OverloadDecl

Constructor accepts the explicit overload seam plus plain TypeScript option-object configuration.

string

Type[]

Type

boolean

OverloadDeclOptions = {}

OverloadDecl

argTypes(): Type[]

ArgTypes contains the set of argument types expected by the overload.

For member functions ArgTypes[0] represents the member operand type.

Type[]


asyncOpValue(): AsyncOp | undefined

asyncOpValue returns the asynchronous implementation, if one is configured.

AsyncOp | undefined


binaryOpValue(): BinaryOp | undefined

BinaryOp | undefined


doc(): string

string


examples(): string[]

Examples returns a list of string examples for the overload.

string[]


functionOpValue(): FunctionOp | undefined

FunctionOp | undefined


guardedAsyncOp(funcName, disableTypeGuards): AsyncOp | undefined

guardedAsyncOp creates a runtime type guard around an asynchronous binding.

string

boolean

AsyncOp | undefined


guardedBinaryOp(funcName, disableTypeGuards): BinaryOp | undefined

guardedBinaryOp creates an invocation guard around the provided binary operator, if one is defined.

string

boolean

BinaryOp | undefined


guardedFunctionOp(funcName, disableTypeGuards): FunctionOp | undefined

guardedFunctionOp creates an invocation guard around the provided variadic function binding, if one is provided.

string

boolean

FunctionOp | undefined


guardedUnaryOp(funcName, disableTypeGuards): UnaryOp | undefined

guardedUnaryOp creates an invocation guard around the provided unary operator, if one is defined.

string

boolean

UnaryOp | undefined


hasBinding(): boolean

HasBinding indicates whether the overload already has a definition.

boolean


hasLateBinding(): boolean

HasLateBinding returns whether the overload has a binding which is not known at compile time.

boolean


id(): string

ID mirrors the overload signature and provides a unique id which may be referenced within the type-checker and interpreter to optimize performance.

The ID format is usually one of two styles: global: member: _

string


isMemberFunction(): boolean

IsMemberFunction indicates whether the overload is a member function

boolean


isNonStrict(): boolean

IsNonStrict returns whether the overload accepts errors and unknown values as arguments.

boolean


matchesRuntimeBinarySignature(disableTypeGuards, arg1, arg2): boolean

matchesRuntimeBinarySignature indicates whether the argument types are runtime assiganble to the overload’s expected arguments.

boolean

Val

Val

boolean


matchesRuntimeSignature(disableTypeGuards, …args): boolean

matchesRuntimeSignature indicates whether the argument types are runtime assiganble to the overload’s expected arguments.

boolean

…Val[]

boolean


matchesRuntimeUnarySignature(disableTypeGuards, arg): boolean

matchesRuntimeUnarySignature indicates whether the argument type is runtime assiganble to the overload’s expected argument.

boolean

Val

boolean


operandTrait(): number

OperandTrait returns the trait mask of the first operand to the overload call, e.g. traits.Indexer

number


resultType(): Type

ResultType indicates the output type from calling the function.

Type


setDoc(doc): void

string

void


signatureEquals(other): boolean

SignatureEquals determines whether the incoming overload declaration signature is equal to the current signature.

Result type, operand trait, and strict-ness are not considered as part of signature equality.

OverloadDecl

boolean


signatureOverlaps(other): boolean

SignatureOverlaps indicates whether two functions have non-equal, but overloapping function signatures.

For example, list(dyn) collides with list(string) since the ‘dyn’ type can contain a ‘string’ type.

OverloadDecl

boolean


typeParams(): string[]

TypeParams returns the type parameter names associated with the overload.

string[]


unaryOpValue(): UnaryOp | undefined

UnaryOp | undefined