@augment-vir/assert
Version:
A collection of assertions for test and production code alike.
43 lines (42 loc) • 1.38 kB
TypeScript
import { tsTypeGuards } from '../../assertions/equality/ts-type-equality.js';
import { extendableAssertions } from '../../assertions/extendable-assertions.js';
declare const extraAssertions: {
/**
* Immediately throw an assertion error.
*
* @example
*
* ```ts
* import {assert} from '@augment-vir/assert';
*
* assert.fail(); // throws an `AssertionError`
* ```
*
* @throws {@link AssertionError}
*/
fail: (failureMessage?: string | undefined) => never;
};
declare const allAssertions: typeof tsTypeGuards.assert & typeof extendableAssertions & typeof extraAssertions;
/**
* A group of guard methods that assert their conditions and do nothing else.
*
* This can also be called as a standalone assertion function which asserts that its input is
* truthy.
*
* @category Assert
* @category Package : @augment-vir/assert
* @example
*
* ```ts
* import {assert} from '@augment-vir/assert';
*
* const value: unknown = 'some value' as unknown;
* assert.isString(value);
* // `value` will now be typed as a `string`
* ```
*
* @throws {@link AssertionError} When the assertion fails.
* @package [`@augment-vir/assert`](https://www.npmjs.com/package/@augment-vir/assert)
*/
export declare const assert: ((input: unknown, failureMessage?: string | undefined) => void) & typeof allAssertions;
export {};