Skip to main content

Class: Optional<T>

A type that represents an optional value.

Type Parameters

Type ParameterDescription

T

The type of the value that can be optional.

Implements

Constructors

new Optional()

new Optional<T>(schema: Schema<T>): Optional<T>

Creates a new Optional type.

Parameters

ParameterTypeDescription

schema

Schema<T>

The schema that describes the type of the value that can be optional.

Returns

Optional<T>

Defined in

types/optional.ts:21

Methods

write()

write(writer: ByteStreamWriter, value: null | T): void

Writes the Schema to the buffer.

Parameters

ParameterTypeDescription

writer

ByteStreamWriter

The buffer writer.

value

null | T

The Schema value to write, or null.

Returns

void

Implementation of

Schema.write

Defined in

types/optional.ts:30


read()

read(reader: ByteStreamReader): null | T

Reads the Schema from the buffer.

Parameters

ParameterTypeDescription

reader

ByteStreamReader

The buffer reader.

Returns

null | T

The Schema read from the buffer or null.

Implementation of

Schema.read

Defined in

types/optional.ts:42