Skip to main content
Home

Built and signed on GitHub Actions

Works with
This package works with Node.js, DenoIt is unknown whether this package works with Cloudflare Workers, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score100%
Downloads5/wk
Published2 days ago (0.2.0)

Type-safe runtime assertions with definable error factories and TypeScript narrowing

default

Type-safe runtime assertions with definable error factories and TypeScript narrowing.

f
assert

Assert a condition is truthy (tiny-invariant style with inline configuration). Uses TypeScript's asserts to narrow types based on the condition.

T
AssertArg

Argument can be message string/function or full options object.

c
AssertError

Default error class for assert.

I
AssertOptions

Options for assert with inline configuration.

T
Constructor

Constructor type for instanceof checks. Supports no-arg, message-only, and Error-style constructors.

f
defineEnsure

Create an ensure validator with custom configuration.

I
DefineEnsureConfig

Configuration for defineEnsure factory.

T
DefineEnsureReturn

Return type of defineEnsure.

v
ensure

Ensure a value is not null, undefined, or false.

T
EnsureArg

Second argument can be message or options object.

c
EnsureError

Default error class for ensure.

I
EnsureFn

The ensure function with attached helpers.

I
EnsureOptions

Options for ensure calls.

T
ErrorConstructor

Error class constructor type.

f
isAssertError

Type guard for AssertError.

v
isEnsureError

Type guard for EnsureError.

T
IsErrorFn

Type guard function returned by defineEnsure.

T
Message

Message can be a string or lazy function.

f
supportsCleanStack

Check if Error.captureStackTrace is supported.

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.