Type alias Assert<T>

Assert<T extends ErrorCtor>: ConstructorParameters<T> extends EmptyArray
    ? ((condition: boolean) => asserts condition)
    : ((condition: boolean, ...args: ConstructorParameters<T> | [(() => ConstructorParameters<T>)]) => asserts condition)

Used to explicitly type the assert function returned by createAssert.

Make sure to use typeof before your custom error class, otherwise the type passed will be an instance of the error class instead of the class itself.

Type Parameters

Example

const assert: Assert<typeof MyError> = ...
// ^ don't forget this

Generated using TypeDoc