assert Function

Beta Need strategy for removing assert in production builds

Assert by throwing a programmer error.

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

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: 08 January, 2020