Skip to main content

Class: Type

The class for deep checking Types

Constructors

constructor

new Type(value, parent?)

Parameters

NameTypeDefault valueDescription
valueunknownundefinedThe value to generate a deep Type of
parentnull | TypenullThe parent value used in recursion

Defined in

index.ts:49

Properties

childKeys

Private Readonly childKeys: Map<string, Type>

The child keys of this Type

Defined in

index.ts:38


childValues

Private Readonly childValues: Map<string, Type>

The child values of this Type

Defined in

index.ts:43


is

is: string

The shallow type of this

Defined in

index.ts:28


parent

Private Readonly parent: null | Type

The parent of this Type

Defined in

index.ts:33


value

Readonly value: unknown

The value to generate a deep Type of

Defined in

index.ts:23

Accessors

childTypes

Private get childTypes(): string

The type string for the children of this Type

Returns

string

Defined in

index.ts:58

Methods

addEntry

Private addEntry(entry): void

The subtype to create based on this.value's entries.

Parameters

NameTypeDescription
entry[string, unknown]The entry

Returns

void

Defined in

index.ts:101


addValue

Private addValue(value): void

The subtype to create based on this.value's sub value.

Parameters

NameTypeDescription
valueunknownThe sub value

Returns

void

Defined in

index.ts:92


check

Private check(): void

Get the deep type name that defines the input.

Returns

void

Defined in

index.ts:110


isCircular

Private isCircular(): boolean

Checks if the value of this Type is a circular reference to any parent.

Returns

boolean

Defined in

index.ts:83


parents

Private parents(): IterableIterator<Type>

Walks the linked list backwards, for checking circulars.

Returns

IterableIterator<Type>

Defined in

index.ts:74


toString

toString(): string

The full type string generated.

Returns

string

Defined in

index.ts:66


list

Static Private list(values): string

Joins the list of child types.

Parameters

NameTypeDescription
valuesMap<string, Type>The values to list

Returns

string

Defined in

index.ts:157


resolve

Static resolve(value): string

Resolves the type name that defines the input.

Parameters

NameTypeDescription
valueanyThe value to get the type name of

Returns

string

Defined in

index.ts:139