assert
Asserts that a condition is true. Throws if it is not.
Use in place of /* v8 ignore *\/ for defensive guards that should never trigger at runtime but would otherwise create uncovered branches.
Import:
import { assert } from 'obsidian-dev-utils/type-guards';Signature:
function assert(condition: boolean, errorOrMessage: string | Error): voidParameters:
| Parameter | Type | Description |
|---|---|---|
condition | boolean | The condition to assert. |
errorOrMessage | string | Error | The error or message to throw if the condition is false. |
Returns: void