enso/app/ide-desktop/debugGlobals.ts
2023-06-19 01:02:08 +02:00

14 lines
386 B
TypeScript

/** @file Debug-only functions, injected or stripped by the build tool as appropriate. */
/** The logger used by {@link assert}. */
interface Logger {
error: (message: string) => void
}
/** Logs an error . */
export function assert(invariant: boolean, message: string, logger: Logger = console) {
if (!invariant) {
logger.error('assertion failed: ' + message)
}
}