Skip to main content

Class: Type

The class for deep checking Types

Constructors

constructor

new Type(value, parent?): Type

Parameters

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

Returns

Type

Defined in

index.ts:50

Properties

childKeys

Private Readonly childKeys: Map<string, Type>

The child keys of this Type

Defined in

index.ts:39


childValues

Private Readonly childValues: Map<string, Type>

The child values of this Type

Defined in

index.ts:44


is

is: string

The shallow type of this

Defined in

index.ts:29


parent

Private Readonly parent: null | Type

The parent of this Type

Defined in

index.ts:34


value

Readonly value: unknown

The value to generate a deep Type of

Defined in

index.ts:24

Accessors

childTypes

get childTypes(): string

The type string for the children of this Type

Returns

string

Defined in

index.ts:59

Methods

addEntry

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:102


addValue

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:93


check

check(): void

Get the deep type name that defines the input.

Returns

void

Defined in

index.ts:111


isCircular

isCircular(): boolean

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

Returns

boolean

Defined in

index.ts:84


parents

parents(): IterableIterator<Type>

Walks the linked list backwards, for checking circulars.

Returns

IterableIterator<Type>

Defined in

index.ts:75


toString

toString(): string

The full type string generated.

Returns

string

Defined in

index.ts:67


list

list(values): string

Joins the list of child types.

Parameters

NameTypeDescription
valuesMap<string, Type>The values to list

Returns

string

Defined in

index.ts:158


resolve

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:140