OverloadDecl
OverloadDecl contains the definition of a single overload id with a specific signature, and an optional implementation.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new OverloadDecl(
idValue,argTypesValue,resultTypeValue,memberFunction,options?):OverloadDecl
Constructor accepts the explicit overload seam plus plain TypeScript option-object configuration.
Parameters
Section titled “Parameters”idValue
Section titled “idValue”string
argTypesValue
Section titled “argTypesValue”Type[]
resultTypeValue
Section titled “resultTypeValue”memberFunction
Section titled “memberFunction”boolean
options?
Section titled “options?”OverloadDeclOptions = {}
Returns
Section titled “Returns”OverloadDecl
Methods
Section titled “Methods”argTypes()
Section titled “argTypes()”argTypes():
Type[]
ArgTypes contains the set of argument types expected by the overload.
For member functions ArgTypes[0] represents the member operand type.
Returns
Section titled “Returns”Type[]
asyncOpValue()
Section titled “asyncOpValue()”asyncOpValue():
AsyncOp|undefined
asyncOpValue returns the asynchronous implementation, if one is configured.
Returns
Section titled “Returns”AsyncOp | undefined
binaryOpValue()
Section titled “binaryOpValue()”binaryOpValue():
BinaryOp|undefined
Returns
Section titled “Returns”BinaryOp | undefined
doc():
string
Returns
Section titled “Returns”string
examples()
Section titled “examples()”examples():
string[]
Examples returns a list of string examples for the overload.
Returns
Section titled “Returns”string[]
functionOpValue()
Section titled “functionOpValue()”functionOpValue():
FunctionOp|undefined
Returns
Section titled “Returns”FunctionOp | undefined
guardedAsyncOp()
Section titled “guardedAsyncOp()”guardedAsyncOp(
funcName,disableTypeGuards):AsyncOp|undefined
guardedAsyncOp creates a runtime type guard around an asynchronous binding.
Parameters
Section titled “Parameters”funcName
Section titled “funcName”string
disableTypeGuards
Section titled “disableTypeGuards”boolean
Returns
Section titled “Returns”AsyncOp | undefined
guardedBinaryOp()
Section titled “guardedBinaryOp()”guardedBinaryOp(
funcName,disableTypeGuards):BinaryOp|undefined
guardedBinaryOp creates an invocation guard around the provided binary operator, if one is defined.
Parameters
Section titled “Parameters”funcName
Section titled “funcName”string
disableTypeGuards
Section titled “disableTypeGuards”boolean
Returns
Section titled “Returns”BinaryOp | undefined
guardedFunctionOp()
Section titled “guardedFunctionOp()”guardedFunctionOp(
funcName,disableTypeGuards):FunctionOp|undefined
guardedFunctionOp creates an invocation guard around the provided variadic function binding, if one is provided.
Parameters
Section titled “Parameters”funcName
Section titled “funcName”string
disableTypeGuards
Section titled “disableTypeGuards”boolean
Returns
Section titled “Returns”FunctionOp | undefined
guardedUnaryOp()
Section titled “guardedUnaryOp()”guardedUnaryOp(
funcName,disableTypeGuards):UnaryOp|undefined
guardedUnaryOp creates an invocation guard around the provided unary operator, if one is defined.
Parameters
Section titled “Parameters”funcName
Section titled “funcName”string
disableTypeGuards
Section titled “disableTypeGuards”boolean
Returns
Section titled “Returns”UnaryOp | undefined
hasBinding()
Section titled “hasBinding()”hasBinding():
boolean
HasBinding indicates whether the overload already has a definition.
Returns
Section titled “Returns”boolean
hasLateBinding()
Section titled “hasLateBinding()”hasLateBinding():
boolean
HasLateBinding returns whether the overload has a binding which is not known at compile time.
Returns
Section titled “Returns”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:
Returns
Section titled “Returns”string
isMemberFunction()
Section titled “isMemberFunction()”isMemberFunction():
boolean
IsMemberFunction indicates whether the overload is a member function
Returns
Section titled “Returns”boolean
isNonStrict()
Section titled “isNonStrict()”isNonStrict():
boolean
IsNonStrict returns whether the overload accepts errors and unknown values as arguments.
Returns
Section titled “Returns”boolean
matchesRuntimeBinarySignature()
Section titled “matchesRuntimeBinarySignature()”matchesRuntimeBinarySignature(
disableTypeGuards,arg1,arg2):boolean
matchesRuntimeBinarySignature indicates whether the argument types are runtime assiganble to the overload’s expected arguments.
Parameters
Section titled “Parameters”disableTypeGuards
Section titled “disableTypeGuards”boolean
Returns
Section titled “Returns”boolean
matchesRuntimeSignature()
Section titled “matchesRuntimeSignature()”matchesRuntimeSignature(
disableTypeGuards, …args):boolean
matchesRuntimeSignature indicates whether the argument types are runtime assiganble to the overload’s expected arguments.
Parameters
Section titled “Parameters”disableTypeGuards
Section titled “disableTypeGuards”boolean
…Val[]
Returns
Section titled “Returns”boolean
matchesRuntimeUnarySignature()
Section titled “matchesRuntimeUnarySignature()”matchesRuntimeUnarySignature(
disableTypeGuards,arg):boolean
matchesRuntimeUnarySignature indicates whether the argument type is runtime assiganble to the overload’s expected argument.
Parameters
Section titled “Parameters”disableTypeGuards
Section titled “disableTypeGuards”boolean
Returns
Section titled “Returns”boolean
operandTrait()
Section titled “operandTrait()”operandTrait():
number
OperandTrait returns the trait mask of the first operand to the overload call, e.g.
traits.Indexer
Returns
Section titled “Returns”number
resultType()
Section titled “resultType()”resultType():
Type
ResultType indicates the output type from calling the function.
Returns
Section titled “Returns”setDoc()
Section titled “setDoc()”setDoc(
doc):void
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
signatureEquals()
Section titled “signatureEquals()”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.
Parameters
Section titled “Parameters”OverloadDecl
Returns
Section titled “Returns”boolean
signatureOverlaps()
Section titled “signatureOverlaps()”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.
Parameters
Section titled “Parameters”OverloadDecl
Returns
Section titled “Returns”boolean
typeParams()
Section titled “typeParams()”typeParams():
string[]
TypeParams returns the type parameter names associated with the overload.
Returns
Section titled “Returns”string[]
unaryOpValue()
Section titled “unaryOpValue()”unaryOpValue():
UnaryOp|undefined
Returns
Section titled “Returns”UnaryOp | undefined