Skip to main content

Class: Type

The class for deep checking Types

Constructors

new Type()

new Type(value: unknown, parent: null | Type): Type

Parameters

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

Returns

Type

Source

index.ts:50

Properties

childKeys

private readonly childKeys: Map<string, Type>

The child keys of this Type

Source

index.ts:39


childValues

private readonly childValues: Map<string, Type>

The child values of this Type

Source

index.ts:44


is

is: string

The shallow type of this

Source

index.ts:29


parent

private readonly parent: null | Type

The parent of this Type

Source

index.ts:34


value

readonly value: unknown

The value to generate a deep Type of

Source

index.ts:24

Accessors

childTypes

get private childTypes(): string

The type string for the children of this Type

Returns

string

Source

index.ts:59

Methods

addEntry()

private addEntry(entry: [string, unknown]): void

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

Parameters

ParameterTypeDescription
entry[string, unknown]The entry

Returns

void

Source

index.ts:102


addValue()

private addValue(value: unknown): void

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

Parameters

ParameterTypeDescription
valueunknownThe sub value

Returns

void

Source

index.ts:93


check()

private check(): void

Get the deep type name that defines the input.

Returns

void

Source

index.ts:111


isCircular()

private isCircular(): boolean

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

Returns

boolean

Source

index.ts:84


parents()

private parents(): IterableIterator <Type>

Walks the linked list backwards, for checking circulars.

Returns

IterableIterator <Type>

Source

index.ts:75


toString()

toString(): string

The full type string generated.

Returns

string

Source

index.ts:67


list()

static private list(values: Map<string, Type>): string

Joins the list of child types.

Parameters

ParameterTypeDescription
valuesMap<string, Type>The values to list

Returns

string

Source

index.ts:158


resolve()

static resolve(value: any): string

Resolves the type name that defines the input.

Parameters

ParameterTypeDescription
valueanyThe value to get the type name of

Returns

string

Source

index.ts:140