Represents a type predicate.

function isString(anything: any): anything is string {}
function assert(condition: boolean): asserts condition {}

Hierarchy

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

    • Optional targetType: 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 PredicateType

Properties

asserts: boolean
name: string
targetType?: SomeType
type: "predicate" = "predicate"

The type name identifier.

Methods

  • getTypeString(): string
  • Return a string representation of this type.

    Returns string

  • needsParenthesis(): boolean
  • toString(): string
  • Return a string representation of this type.

    Returns string

  • Visit this type, returning the value returned by the visitor.

    Type Parameters

    • T

    Parameters

    Returns T

  • Type Parameters

    • T

    Parameters

    Returns undefined | T

Generated using TypeDoc