Skip to content
Trevor Sears edited this page Mar 5, 2020 · 2 revisions

Table of Contents

Overview

TODO

Documentation

Type

An interface for all Typit types.

Type Parameters:

  • E The compile-time type of the given Type instance.
interface Type<E = any> { ... }

#isOptional

Returns the optionality of this Type.

Parameters:

  • None

Returns true if this Type is optional.

isOptional(): boolean;

#getTypeName

Returns the string name of this Type.

Parameters:

  • None

Returns The string name of this Type.

getTypeName(): string;

#checkConformity

Returns true if and only if the input value conforms to this Type.

Parameters:

  • input Any variable to check for conformity to this Type.

Returns true if and only if the input value conforms to this Type

checkConformity(input: any): boolean;

#checkConformityOfAll

Returns true if and only if all members passed as arguments conform to this Type.

Parameters:

  • input Any number of variables to check for conformity to this Type.

Returns true if and only if all members passed as arguments conform to this Type.

checkConformityOfAll(...input: any[]): boolean;

#exhaustivelyCheckConformity

Returns true if and only if the input value exhaustively conforms to this Type.

Note that the exact definition of "exhaustively conformity" differs between Types.

Parameters:

  • input Any variable to exhaustively check for conformity to this Type.

Returns true if and only if the input value exhaustively conforms to this Type.

exhaustivelyCheckConformity(input: any): boolean;

#exhaustivelyCheckConformityOfAll

Returns true if and only if all members passed as arguments exhaustively conform to this Type.

Note that the exact definition of "exhaustively conformity" differs between Types.

Parameters:

  • input Any number of variables to exhaustively check for conformity to this Type.

Returns true if and only if all members passed as arguments exhaustively conform to this Type.

exhaustivelyCheckConformityOfAll(...input: any[]): boolean;

#sanitize

Either returns the given input if it correctly conforms to this Type, or throws a TypeError.

Parameters:

  • input The input to sanitize.

Returns The given input if it correctly conforms to this Type.

Throws A TypeError if the provided input does not correctly conform to this Type.

sanitize(input: any): E;