The type of value this choice type can write.
If you provide, e.g. a Type<A>
and a Type<B>
and a Type<C>
to the constructor, E
should be A | B | C
.
In TypeScript, you have to declare this manually
unless all the value types are identical.
The type of values this type will read
The list of possible types. Values will be written using the first type in the list that successfully writes the value, so place higher priority types earlier.
Requires that the buffer be a GrowableBuffer or AppendableStream
The value to assert is an AppendableBuffer
Determines whether the input is a Type with the same class
A value, usually a Type instance
whether this
and otherType
are instances of the same Type class
Appends value bytes to an AppendableBuffer according to the type
Examples:
type.writeValue(buffer, {hex: '#abcdef'}) //writes using hexType
or
type.writeValue(buffer, {r: 1, g: 0, b: 0.5}) //writes using rgbType
or
type.writeValue(buffer, 180) //writes using hueType
The buffer to which to append
The value to write
Generated using TypeDoc
A type storing a value of one of several fixed types.
Example: