API Reference > bentleyjs-core > Utils > assert 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". Returns - condition Defined in core/bentley/src/Assert.ts Line 19 Last Updated: 13 June, 2024