assert Function

Beta Need strategy for removing assert in production builds

Assert by throwing a programmer error.

assert(condition: boolean, msg?: string): condition

throws Error containing the specified message if condition is false.

note This function should be used to validate conditions that should never realistically occur, or which indicate a misuse of the API which should be eliminated during development.

Parameter Type Description
condition boolean The result of a boolean expression.
msg string An optional message to include in the thrown exception. Defaults to "Programmer Error".

Defined in

Last Updated: 23 April, 2020