Represents a type predicate.

function isString(x: unknown): x is string {}
function assert(condition: boolean): asserts condition {}

Hierarchy (View Summary)

Constructors

  • Create a new PredicateType instance.

    Parameters

    • name: string

      The identifier name which is tested by the predicate.

    • asserts: boolean

      True if the type is of the form asserts val is string, false if the type is of the form val is string

    • OptionaltargetType: Models.SomeType

      The type that the identifier is tested to be. May be undefined if the type is of the form asserts val. Will be defined if the type is of the form asserts val is string or val is string.

    Returns Models.PredicateType

Methods

Properties

asserts: boolean

True if the type is of the form asserts val is string, false if the type is of the form val is string

name: string

The identifier name which is tested by the predicate.

type: "predicate"

The type name identifier.

targetType?: Models.SomeType

The type that the identifier is tested to be. May be undefined if the type is of the form asserts val. Will be defined if the type is of the form asserts val is string or val is string.