ok

View Source

Summary

Asserts that value is truthy. Narrows the type of value after the call.

Signature

function ok(value: unknown, message: string): asserts value;

Example

const cookie = getSessionCookie(response)
assert.ok(cookie) // cookie is now `string` (not `string | null`)

Params

value

The value to test for truthiness.

message

Optional failure message.