Interface Type<A>

Type API.

interface Type<A> {
    constructor: any;
    name: string;
    inter<B>(typeName: string, B: Type<B>): Type<A & B>;
    union<B>(typeName: string, B: Type<B>): Type<A | B>;
}

Type Parameters

  • A

Constructors

Properties

Methods

Constructors

constructor: any

Properties

name: string

Name of the type.

Methods

  • Create an intersection type from another type.

    Type Parameters

    • B

    Parameters

    • typeName: string
    • B: Type<B>

    Returns Type<A & B>

    const A = Type<A>("A");
    const B = Type<B>("B");

    A.inter("I", B); // => Type<A & B>
  • Create a union type from another type.

    Type Parameters

    • B

    Parameters

    • typeName: string
    • B: Type<B>

    Returns Type<A | B>

    const A = Type<A>("A");
    const B = Type<B>("B");

    A.union("U", B); // => Type<A | B>