Function isType

  • Does a generic check to check that the given payload is of a given type. In cases like Number, it will return true for NaN as NaN is a Number (thanks javascript!); It will, however, differentiate between object and null

    Type Parameters

    Parameters

    • payload: unknown
    • type: T

    Returns payload is T

    Throws

    Will throw type error if type is an invalid type