Type System¶
The type system defines every type the Viper runtime understands. Type is the
base class: it exposes the primitive types as static accessors (Type.INT64,
Type.STRING, …) and serves as the common supertype of the parameterized
container, algebraic, and user-defined types.
When to use: reach for types to describe schemas, to validate data, and to build parameterized containers such as vectors and maps before instantiating values against them.
Quick Start¶
const { Type, TypeVector, TypeMap, TypeOptional } = require('@digitalsubstrate/dsviper');
// Primitive types are static accessors on Type
const tInt = Type.INT64;
const tStr = Type.STRING;
tStr.representation(); // "string"
// Parameterized container types — construct with `new`
const tVec = new TypeVector(Type.STRING); // vector<string>
const tMap = new TypeMap(Type.STRING, Type.INT64);
tMap.representation(); // "map<string, int64>"
// Nested types compose freely
const tNested = new TypeMap(Type.STRING, new TypeVector(Type.FLOAT));
// Nullable type
const tOpt = new TypeOptional(Type.STRING);
tOpt.representation(); // "optional<string>"
A type is the schema half of the runtime; pair it with Value.create(type, native)
to mint an instance (see Values):
const { Value, Type } = require('@digitalsubstrate/dsviper');
const v = Value.create(Type.STRING, 'hi'); // a ValueString
v.encoded(); // "hi"
Choosing the Right Type¶
Use Case |
Type Class |
Example |
|---|---|---|
Primitive value |
|
static accessors |
Homogeneous list |
|
|
Key-value mapping |
|
|
Nullable value |
|
|
Concurrent list |
|
|
Fixed-size tuple |
|
The mirror of this page for the Python binding is Type System; for a narrative walkthrough of types and values together, see Types and Values.
Generated from the @digitalsubstrate/dsviper TypeScript declarations (index.d.ts) by TypeDoc.
Base Class¶
Primitive Types¶
Class |
Description |
|---|---|
The void type |
|
The bool type |
|
The uint8 type |
|
The uint16 type |
|
The uint32 type |
|
The uint64 type |
|
The int8 type |
|
The int16 type |
|
The int32 type |
|
The int64 type |
|
The float type |
|
The double type |
|
The string type |
|
The blob type |
|
The blob_id type |
|
The commit_id type |
|
The uuid type |
Container Types¶
Class |
Description |
|---|---|
The vector |
|
The set |
|
The map<keyType, elementType> type |
|
The xarray |
|
The optional |
Algebraic Types¶
Class |
Description |
|---|---|
The tuple<T0, …> type |
|
The vec<numericType, size> type |
|
The mat<numericType, columns, rows> type |
|
The variant<T0, …> type |
|
The any type |
User-Defined Types¶
Class |
Description |
|---|---|
A struct type |
|
Describes the fields a struct will be created with |
|
One field of a struct type, as TypeStructure.fields(), query() and check() answer it |
|
An enum type |
|
One case of an enum type, as TypeEnumeration.cases(), query() and check() answer it |
|
Describes the cases an enum will be created with |
Concept Types¶
Class |
Description |
|---|---|
A concept type |
|
A club type |
|
The key |
|
The any_concept type |
Reference¶
- class Type()¶
The primitive types, and the utilities that act on any type.
Type.INT64, Type.STRING and the other scalars are read from here; the parameterized types are their own classes. Also encodes, decodes and sizes a type, and hashes it.
Note: Not directly instantiable.
exported from
index.d- Type.ANY¶
type: readonly TypeAny
- Type.ANY_CONCEPT¶
type: readonly TypeAnyConcept
- Type.BLOB¶
type: readonly TypeBlob
- Type.BLOB_ID¶
type: readonly TypeBlobId
- Type.BOOL¶
type: readonly TypeBool
- Type.COMMIT_ID¶
type: readonly TypeCommitId
- Type.DOUBLE¶
type: readonly TypeDouble
- Type.FLOAT¶
type: readonly TypeFloat
- Type.INT16¶
type: readonly TypeInt16
- Type.INT32¶
type: readonly TypeInt32
- Type.INT64¶
type: readonly TypeInt64
- Type.INT8¶
type: readonly TypeInt8
- Type.STRING¶
type: readonly TypeString
- Type.UINT16¶
type: readonly TypeUInt16
- Type.UINT32¶
type: readonly TypeUInt32
- Type.UINT64¶
type: readonly TypeUInt64
- Type.UINT8¶
type: readonly TypeUInt8
- Type.UUID¶
type: readonly TypeUUId
- Type.VOID¶
type: readonly TypeVoid
- Type.compare(other)¶
- Arguments:
other (Type)
- Returns:
number
- Type.description(namespace)¶
- Return the same as representation(), with three exceptions: a struct spells out
its fields as name:type with their defaults, an enum spells out its cases as .name, and a variant writes variant<T0, T1, …> where representation() gives the bare T0|T1|…. namespace qualifies the names.
- Arguments:
namespace (NameSpace | null)
- Returns:
string
- Type.equals(other)¶
- Arguments:
other (unknown)
- Returns:
boolean
- Type.representation(namespace)¶
- Return the type written out: the declared name for a named type, or the
parameterised form for a composed one - vector<element>, map<key, element>, vec<element, size>. namespace qualifies the names; the global namespace is used when it is undefined.
- Arguments:
namespace (NameSpace | null)
- Returns:
string
- Type.runtimeId()¶
Return the uuid identifying this type.
It is computed from what the type is, so the same declaration yields the same id in any Definitions. Definitions says what each kind is computed from.
- Returns:
ValueUUId
- Type.toString()¶
- Returns:
string
- Type.typeCode()¶
- Return the code naming this kind of type, such as “int32”, “struct” or
“vector”.
- Returns:
string
- static Type.decode(blob, definitions, streamCodecInstancing)¶
- Return a type by decoding the blob with Codec.STREAM_BINARY if not
specified.
- Arguments:
blob (ValueBlob)
definitions (DefinitionsConst)
streamCodecInstancing (StreamCodecInstancing | null)
- Returns:
Type
- static Type.encode(type, streamCodecInstancing)¶
- Return a blob that encodes the type with Codec.STREAM_BINARY if not
specified.
- Arguments:
type (Type)
streamCodecInstancing (StreamCodecInstancing | null)
- Returns:
ValueBlob
- static Type.hexdigest(type, hashing)¶
- Return the hexa digest of the type computed with the hashing interface
if specified else use SHA1.
- Arguments:
type (Type)
hashing (Hashing | null)
- Returns:
string
- static Type.isSized(type)¶
Return true if the type has a fixed size and reads back alone.
A key is two uuids yet not sized: reading one back needs the definitions, which a pack-sized vector does not hold.
- Arguments:
type (Type)
- Returns:
boolean
- static Type.read(streamReading, definitions)¶
Read and return a type.
- Arguments:
streamReading (StreamReading)
definitions (DefinitionsConst)
- Returns:
Type
- static Type.sizeOf(type, streamSizing)¶
Return the fixed size of the type or throw.
- Arguments:
type (Type)
streamSizing (StreamSizing)
- Returns:
number
- static Type.useBlobId(type)¶
Return true if the type uses the type blob_id.
- Arguments:
type (Type)
- Returns:
boolean
- static Type.useCommitId(type)¶
Return true if the type uses the type commit_id.
- Arguments:
type (Type)
- Returns:
boolean
- static Type.write(type, streamWriting)¶
Write a type.
- Arguments:
type (Type)
streamWriting (StreamWriting)
- class TypeName(nameSpace, name)¶
Describes the name of a type: its namespace and its identifier.
Build one to look a registered type up by name - that is what DefinitionsInspector.checkStructure, checkConcept, checkClub and checkEnumeration take. An attachment is not a type but a declaration binding a concept to one, so checkAttachment takes its identifier instead. Pass NameSpace.GLOBAL for a type of the global namespace.
Two are equal when their namespaces’ uuids and their names are.
exported from
index.d- Build a name to look a registered type up by - what DefinitionsInspector’s
checkStructure, checkConcept, checkClub and checkEnumeration take. An attachment is not a type but a declaration binding a concept to one, so checkAttachment takes its identifier instead. NameSpace.GLOBAL for the global namespace.
- Arguments:
nameSpace (NameSpace)
name (string)
- TypeName.compare(other)¶
Return -1, 0 or 1. Throws if
otheris not a TypeName.- Arguments:
other (TypeName)
- Returns:
number
- TypeName.equals(other)¶
Return true if both are equal.
otherof another type answers false.- Arguments:
other (unknown)
- Returns:
boolean
- TypeName.hashKey()¶
- A value-identity key for a native Map or Set, following equals: the namespace’s
uuid and the name. representation() is not one - two namespaces may share a name. A hash, so collisions are possible but negligible.
- Returns:
bigint
- TypeName.name()¶
Return the name alone, without the namespace it sits in.
- Returns:
string
- TypeName.nameSpace()¶
Return the namespace.
- Returns:
NameSpace
- TypeName.representation()¶
Return the name qualified by its namespace, App::Profile.
The bare name for a type of the global namespace. Where a shorter spelling may still be unambiguous, DefinitionsInspector.representation answers that instead, knowing what else is registered.
It is a name, not an identity: two namespaces may share one.
- Returns:
string
- TypeName.representationIn(nameSpace)¶
Return the name as written from inside nameSpace.
The bare name when it sits in that namespace, the qualified one otherwise.
- Arguments:
nameSpace (NameSpace)
- Returns:
string
- class TypeVoid()¶
The void type.
Use the static property Type.VOID.
exported from
index.d- Extends:
Type
- TypeVoid.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- class TypeBool()¶
The bool type.
Use the static property Type.BOOL.
exported from
index.d- Extends:
Type
- TypeBool.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- class TypeUInt8()¶
The uint8 type.
Use the static property Type.UINT8.
exported from
index.d- Extends:
Type
- TypeUInt8.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- class TypeUInt16()¶
The uint16 type.
Use the static property Type.UINT16.
exported from
index.d- Extends:
Type
- TypeUInt16.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- class TypeUInt32()¶
The uint32 type.
Use the static property Type.UINT32.
exported from
index.d- Extends:
Type
- TypeUInt32.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- class TypeUInt64()¶
The uint64 type.
Use the static property Type.UINT64.
exported from
index.d- Extends:
Type
- TypeUInt64.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- class TypeInt8()¶
The int8 type.
Use the static property Type.INT8.
exported from
index.d- Extends:
Type
- TypeInt8.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- class TypeInt16()¶
The int16 type.
Use the static property Type.INT16.
exported from
index.d- Extends:
Type
- TypeInt16.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- class TypeInt32()¶
The int32 type.
Use the static property Type.INT32.
exported from
index.d- Extends:
Type
- TypeInt32.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- class TypeInt64()¶
The int64 type.
Use the static property Type.INT64.
exported from
index.d- Extends:
Type
- TypeInt64.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- class TypeFloat()¶
The float type.
Use the static property Type.FLOAT.
exported from
index.d- Extends:
Type
- TypeFloat.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- class TypeDouble()¶
The double type.
Use the static property Type.DOUBLE.
exported from
index.d- Extends:
Type
- TypeDouble.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- class TypeString()¶
The string type.
Use the static property Type.STRING.
exported from
index.d- Extends:
Type
- TypeString.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- class TypeBlob()¶
The blob type.
Use the static property Type.BLOB.
exported from
index.d- Extends:
Type
- TypeBlob.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- class TypeBlobId()¶
The blob_id type.
Use the static property Type.BLOB_ID.
exported from
index.d- Extends:
Type
- TypeBlobId.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- class TypeCommitId()¶
The commit_id type.
Use the static property Type.COMMIT_ID.
exported from
index.d- Extends:
Type
- TypeCommitId.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- class TypeUUId()¶
The uuid type.
Use the static property Type.UUID.
exported from
index.d- Extends:
Type
- TypeUUId.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- class TypeVector(elementType)¶
The vector<elementType> type.
elementType() is the Type it holds; ValueVector builds values of it.
exported from
index.d- Extends:
Type
- Arguments:
elementType (Type)
- TypeVector.elementType()¶
Return the type of the elements the vector holds.
- Returns:
Type
- static TypeVector.cast(type)¶
Return a type vector<elementType> or throw.
- Arguments:
type (Type)
- Returns:
TypeVector
- class TypeSet(elementType)¶
The set<elementType> type.
elementType() is the Type of its elements; ValueSet builds values of it.
exported from
index.d- Extends:
Type
- Arguments:
elementType (Type)
- TypeSet.elementType()¶
Return the type of the elements the set holds.
- Returns:
Type
- TypeSet.elementsType()¶
Return vector<elementType>, the type a whole element listing has.
- Returns:
TypeVector
- static TypeSet.cast(type)¶
Return the type set<elementType> or throw.
- Arguments:
type (Type)
- Returns:
TypeSet
- class TypeMap(keyType, elementType)¶
The map<keyType, elementType> type.
keyType() and elementType() are the two Types it pairs; ValueMap builds values of it.
exported from
index.d- Extends:
Type
- Arguments:
keyType (Type)
elementType (Type)
- TypeMap.elementType()¶
Return the type of the values the map holds - keyType() gives the keys.
- Returns:
Type
- TypeMap.itemType()¶
Return tuple<keyType, elementType>, the type of one entry.
- Returns:
TypeTuple
- TypeMap.itemsType()¶
Return vector<itemType>, the type a whole entry listing has.
- Returns:
TypeVector
- TypeMap.keyType()¶
Return the type of the keys the map is indexed by.
- Returns:
Type
- TypeMap.keysType()¶
Return set<keyType>, the type a whole key listing has.
- Returns:
TypeSet
- TypeMap.valuesType()¶
Return vector<elementType>, the type a whole value listing has.
- Returns:
TypeVector
- static TypeMap.cast(type)¶
Return the type map<keyType, elementType> or throw.
- Arguments:
type (Type)
- Returns:
TypeMap
- class TypeXArray(elementType)¶
The xarray<elementType> type.
elementType() is the Type of its elements; ValueXArray builds values of it.
exported from
index.d- Extends:
Type
- Arguments:
elementType (Type)
- TypeXArray.elementType()¶
Return the type of the elements the xarray holds.
- Returns:
Type
- TypeXArray.elementsType()¶
Return vector<elementType>, the type a whole element listing has.
- Returns:
TypeVector
- static TypeXArray.cast(type)¶
Return a type xarray<elementType> or throw.
- Arguments:
type (Type)
- Returns:
TypeXArray
- class TypeOptional(elementType)¶
The optional<elementType> type.
elementType() is the Type it wraps; ValueOptional builds values of it.
exported from
index.d- Extends:
Type
- Arguments:
elementType (Type)
- TypeOptional.elementType()¶
Return the type of the value held when the optional is not nil.
- Returns:
Type
- static TypeOptional.cast(type)¶
Return the type optional<elementType> or throw.
- Arguments:
type (Type)
- Returns:
TypeOptional
- class TypeTuple(types)¶
The tuple<T0, …> type.
types() gives the members, each a Type; ValueTuple builds values of it.
exported from
index.d- Extends:
Type
- Arguments:
types (Type[])
- TypeTuple.types()¶
Return the list of types.
- Returns:
Type[]
- static TypeTuple.cast(type)¶
Return a type tuple<T0, …> or throw.
- Arguments:
type (Type)
- Returns:
TypeTuple
- class TypeVec(numericType, size)¶
The vec<numericType, size> type.
numericType is one of the integer or floating-point primitives, Type.UINT8 through Type.DOUBLE; Type.BOOL and Type.STRING throw. size is at least 1, and 0 throws. The accessor that reads numericType back is elementType(), and ValueVec builds values of it.
exported from
index.d- Extends:
Type
- Arguments:
numericType (NumericType)
size (number)
- TypeVec.elementType()¶
Return the numeric type of one component.
- Returns:
NumericType
- TypeVec.elementsType()¶
Return vector<elementType>, the type a whole component listing has.
- Returns:
TypeVector
- TypeVec.size()¶
Return the number of elements.
- Returns:
number
- static TypeVec.cast(type)¶
Return type as a TypeVec, or throw if it is not one.
- Arguments:
type (Type)
- Returns:
TypeVec
- class TypeMat(numericType, columns, rows)¶
The mat<numericType, columns, rows> type.
numericType is one of the integer or floating-point primitives, Type.UINT8 through Type.DOUBLE; Type.BOOL and Type.STRING throw. columns and rows are each at least 1, and 0 throws. The accessor that reads numericType back is elementType(), and ValueMat builds values of it.
exported from
index.d- Extends:
Type
- Arguments:
numericType (NumericType)
columns (number)
rows (number)
- TypeMat.columns()¶
Return the number of columns.
- Returns:
number
- TypeMat.elementType()¶
Return the numeric type of one component.
- Returns:
NumericType
- TypeMat.elementsType()¶
Return vector<elementType>, the type a whole component listing has.
- Returns:
TypeVector
- TypeMat.rows()¶
Return the number of rows.
- Returns:
number
- static TypeMat.cast(type)¶
Return the type mat<elementType, columns, rows> or throw.
- Arguments:
type (Type)
- Returns:
TypeMat
- class TypeVariant(types)¶
The variant<T0, …> type.
types() gives the alternatives, each a Type; ValueVariant builds values of it.
exported from
index.d- Extends:
Type
- Arguments:
types (Type[])
- TypeVariant.types()¶
Return the list of types.
- Returns:
Type[]
- static TypeVariant.cast(type)¶
Return a type variant<T0, …> or throw.
- Arguments:
type (Type)
- Returns:
TypeVariant
- class TypeAny()¶
The any type.
Use the static property Type.ANY.
exported from
index.d- Extends:
Type
- TypeAny.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- class TypeStructure()¶
A struct type.
Note: Not directly instantiable.
exported from
index.d- Extends:
Type
- TypeStructure.check(fieldName)¶
Return the field called fieldName, or throw if the struct has none.
- Arguments:
fieldName (string)
- Returns:
TypeStructureField
- TypeStructure.documentation()¶
Return the documentation the type was created with, empty when none was given.
- Returns:
string
- TypeStructure.fields()¶
Return the list of fields.
- Returns:
TypeStructureField[]
- TypeStructure.isCompact()¶
Return true if every field is a bool or a number.
A document tree shows such a structure on one line. Compact is not sized: a vec or a uuid field has a fixed size and is not compact.
- Returns:
boolean
- TypeStructure.query(fieldName)¶
Return the field called fieldName, or undefined if the struct has none.
- Arguments:
fieldName (string)
- Returns:
TypeStructureField | undefined
- TypeStructure.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- static TypeStructure.cast(type)¶
Return a type struct or throw.
- Arguments:
type (Type)
- Returns:
TypeStructure
- class TypeStructureDescriptor(name, documentation)¶
Describes the fields a struct will be created with.
Definitions.createStructure() turns the descriptor into a TypeStructure.
exported from
index.d- Arguments:
name (string)
documentation (string | null)
- TypeStructureDescriptor.addField(fieldName, type, documentation)¶
Add a field called fieldName to the struct being described.
typeOrValue is either the field type, or a value whose type it takes. documentation is carried onto the field.
- Arguments:
fieldName (string)
type (Type)
documentation (string | null)
- TypeStructureDescriptor.description()¶
Return the type spelled out: its fields, then its name.
It reads {}:Name while no field has been added - a shape createStructure refuses, a struct requiring at least one field.
- Returns:
string
- TypeStructureDescriptor.documentation()¶
Return the documentation the struct will be created with, empty when none was given.
- Returns:
string
- TypeStructureDescriptor.fields()¶
Return the list of fields.
- Returns:
TypeStructureField[]
- TypeStructureDescriptor.name()¶
Return the name the struct will be created under.
- Returns:
string
- class TypeStructureField()¶
One field of a struct type, as TypeStructure.fields(), query() and check() answer it.
Note: Not directly instantiable.
exported from
index.d- TypeStructureField.defaultValue(encoded)¶
Return the default value or undefined.
Passing encoded false returns a Value rather than a native JS value.
- Arguments:
encoded (boolean | null)
- Returns:
Value | OutputValue | undefined
- TypeStructureField.documentation()¶
Return the documentation the field was created with, empty when none was given.
- Returns:
string
- TypeStructureField.name()¶
Return the field name as declared.
- Returns:
string
- TypeStructureField.type()¶
Return the type the field is declared with.
- Returns:
Type
- class TypeEnumeration()¶
An enum type.
Note: Not directly instantiable.
exported from
index.d- Extends:
Type
- TypeEnumeration.cases()¶
Return the list of cases.
- Returns:
TypeEnumerationCase[]
- TypeEnumeration.check(name)¶
Return the case called name, or throw if the enum has none.
- Arguments:
name (string)
- Returns:
TypeEnumerationCase
- TypeEnumeration.documentation()¶
Return the documentation the enum was created with, empty when none was given.
- Returns:
string
- TypeEnumeration.query(name)¶
Return the case called name, or undefined if the enum has none.
- Arguments:
name (string)
- Returns:
TypeEnumerationCase | undefined
- TypeEnumeration.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- static TypeEnumeration.cast(type)¶
Return a type enum or throw.
- Arguments:
type (Type)
- Returns:
TypeEnumeration
- class TypeEnumerationCase()¶
One case of an enum type, as TypeEnumeration.cases(), query() and check() answer it.
Note: Not directly instantiable.
exported from
index.d- TypeEnumerationCase.documentation()¶
Return the documentation the case was created with, empty when none was given.
- Returns:
string
- TypeEnumerationCase.name()¶
Return the case name as declared.
- Returns:
string
- class TypeEnumerationDescriptor(name, documentation)¶
Describes the cases an enum will be created with.
Definitions.createEnumeration() turns the descriptor into a TypeEnumeration.
exported from
index.d- Arguments:
name (string)
documentation (string | null)
- TypeEnumerationDescriptor.addCase(name, documentation)¶
Add a case called name to the enum being described.
documentation is carried onto the case.
- Arguments:
name (string)
documentation (string | null)
- TypeEnumerationDescriptor.cases()¶
Return the list of cases.
- Returns:
TypeEnumerationCase[]
- TypeEnumerationDescriptor.description()¶
Return the type spelled out: its cases, then its name.
It reads {}:Name while no case has been added - a shape createEnumeration refuses, an enum requiring at least one case.
- Returns:
string
- TypeEnumerationDescriptor.documentation()¶
- Return the documentation the enumeration will be created with, empty when none was
given.
- Returns:
string
- TypeEnumerationDescriptor.name()¶
Return the name the enum will be created under.
- Returns:
string
- class TypeConcept()¶
A concept type.
Note: Not directly instantiable.
exported from
index.d- Extends:
Type
- TypeConcept.documentation()¶
Return the documentation the concept was created with, empty when none was given.
- Returns:
string
- TypeConcept.isMember(typeConcept)¶
Return true if this concept is typeConcept or specialises it.
Following parent() upwards from this concept reaches typeConcept. The receiver is the member here; TypeClub.isMember asks the reverse, whether the argument is one of the club’s members.
- Arguments:
typeConcept (TypeConcept)
- Returns:
boolean
- TypeConcept.parent()¶
Return the parent concept or undefined.
- Returns:
TypeConcept | undefined
- TypeConcept.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- static TypeConcept.cast(type)¶
Return type as a TypeConcept, or throw if it is not one.
- Arguments:
type (Type)
- Returns:
TypeConcept
- class TypeClub()¶
A club type.
Note: Not directly instantiable.
exported from
index.d- Extends:
Type
- TypeClub.documentation()¶
Return the documentation the club was created with, empty when none was given.
- Returns:
string
- TypeClub.isMember(typeConcept)¶
Return true if typeConcept is one of members().
The argument is the member here; TypeConcept.isMember asks the reverse, whether the receiver specialises the argument.
- Arguments:
typeConcept (TypeConcept)
- Returns:
boolean
- TypeClub.members()¶
Return the list of concepts.
- Returns:
TypeConcept[]
- TypeClub.typeName()¶
Return the TypeName: the namespace and the name the type was declared under.
- Returns:
TypeName
- static TypeClub.cast(type)¶
Return a type club or throw.
- Arguments:
type (Type)
- Returns:
TypeClub
- class TypeKey(elementType)¶
The key<elementType> type.
elementType() is a concept, a club or any_concept - isConcept(), isClub() and isAnyConcept() say which; ValueKey builds values of it.
Where a container’s elementType is what it holds, a key’s is what it refers to: a key holds an instance id, never the concept itself.
exported from
index.d- Extends:
Type
- Arguments:
elementType (Type)
- TypeKey.elementType()¶
Return the abstraction the key names: a concept, a club or any_concept.
isConcept(), isClub() and isAnyConcept() say which.
- Returns:
Type
- TypeKey.isAnyConcept()¶
Return true if elementType is any_concept.
- Returns:
boolean
- TypeKey.isClub()¶
Return true if elementType is a club.
- Returns:
boolean
- TypeKey.isConcept()¶
Return true if elementType is a concept.
- Returns:
boolean
- static TypeKey.cast(type)¶
Return the type key<elementType> or throw.
- Arguments:
type (Type)
- Returns:
TypeKey