Function requireType

  • Checks that value has the run-time type given by typeName.

    Works for any runtime JavaScript type, but two values have special meaning. "object" is used specifically to require a non-null non-array object, while "array" is used to mean a non-null array object.

    Parameters

    • nameForErrorMessages: string

      the name for this value, used only for error messages.

    • value: unknown

      the value to check

    • typeName: string

      the expected type

    Returns void

    Throws

    TypeError if the value does not have the expected type

Generated using TypeDoc