Skip to content

assertTrue

Assert that a value is strictly true (not just truthy), with type-narrowing to the literal type true.

import { assertTrue } from "@kensio/smartass";
const isEnabled: unknown = true;
assertTrue(isEnabled);
// isEnabled is now narrowed to true

Source file: src/assert/true/true.assert.ts