Type
Type holds a reference to a runtime type with an optional type-checked set of type parameters.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Type(
kindValue,parametersValue?,runtimeTypeName,isAssignableTypeFn?,isAssignableRuntimeTypeFn?,traitMaskValue?):Type
Parameters
Section titled “Parameters”kindValue
Section titled “kindValue”parametersValue?
Section titled “parametersValue?”Type[] = emptyParams
runtimeTypeName
Section titled “runtimeTypeName”string
isAssignableTypeFn?
Section titled “isAssignableTypeFn?”(other) => boolean
isAssignableRuntimeTypeFn?
Section titled “isAssignableRuntimeTypeFn?”(other) => boolean
traitMaskValue?
Section titled “traitMaskValue?”number = 0
Returns
Section titled “Returns”Type
Methods
Section titled “Methods”convertToNative()
Section titled “convertToNative()”convertToNative(
_typeDesc?):never
ConvertToNative converts the Value to a native TypeScript value according to the provided type description, or throws if the conversion is not feasible.
Parameters
Section titled “Parameters”_typeDesc?
Section titled “_typeDesc?”unknown
Returns
Section titled “Returns”never
Implementation of
Section titled “Implementation of”convertToType()
Section titled “convertToType()”convertToType(
typeValue):Val
ConvertToType supports type conversions between CEL value types supported by the expression language.
Parameters
Section titled “Parameters”typeValue
Section titled “typeValue”Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”declaredTypeName()
Section titled “declaredTypeName()”declaredTypeName():
string
DeclaredTypeName indicates the fully qualified and parameterized type-check type name.
Returns
Section titled “Returns”string
equal()
Section titled “equal()”equal(
other):Val
Equal indicates whether two types have the same runtime type name.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”hasTrait()
Section titled “hasTrait()”hasTrait(
trait):boolean
HasTrait returns whether the type has a given trait associated with it.
See common/types/traits/traits.go for a list of supported traits.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”isAssignableRuntimeType()
Section titled “isAssignableRuntimeType()”isAssignableRuntimeType(
val):boolean
IsAssignableRuntimeType determines whether the current type is runtime assignable from the input runtimeType.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”boolean
isAssignableType()
Section titled “isAssignableType()”isAssignableType(
fromType):boolean
IsAssignableType determines whether the current type is type-check assignable from the input fromType.
Parameters
Section titled “Parameters”fromType
Section titled “fromType”Type
Returns
Section titled “Returns”boolean
isEquivalentType()
Section titled “isEquivalentType()”isEquivalentType(
other):boolean
IsEquivalentType indicates whether two types are equivalent.
Parameters
Section titled “Parameters”Type
Returns
Section titled “Returns”boolean
isExactType()
Section titled “isExactType()”isExactType(
other):boolean
IsExactType indicates whether the two types are exactly the same.
Parameters
Section titled “Parameters”Type
Returns
Section titled “Returns”boolean
kind()
Section titled “kind()”kind():
Kind
Kind indicates general category of the type.
Returns
Section titled “Returns”parameters()
Section titled “parameters()”parameters():
Type[]
Parameters returns the list of type parameters if set.
Returns
Section titled “Returns”Type[]
toString()
Section titled “toString()”toString():
string
String returns a human-readable definition of the type name.
Returns
Section titled “Returns”string
traitMask()
Section titled “traitMask()”traitMask():
number
traitMask returns the internal trait mask for local helpers.
Returns
Section titled “Returns”number
type()
Section titled “type()”type():
RefType
Type returns the TypeValue of the value.
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”typeName()
Section titled “typeName()”typeName():
string
TypeName returns the type-erased fully qualified runtime type name.
Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”value()
Section titled “value()”value():
unknown
Value returns the raw value of the instance which may not be directly compatible with the expression language types.
Returns
Section titled “Returns”unknown
Implementation of
Section titled “Implementation of”withTraits()
Section titled “withTraits()”withTraits(
traits):Type
WithTraits creates a copy of the current Type and sets the trait mask to the traits parameter.
Parameters
Section titled “Parameters”traits
Section titled “traits”number
Returns
Section titled “Returns”Type