nonNullable
nonNullable
Section titled “nonNullable”Matcher for a non-nullable value.
Matchers are applied through assertObjectMatches, where they narrow the corresponding property type.
Type information that already exists in the calling scope is incorporated.
import { assertObjectMatches, nonNullable } from "@kensio/smartass";
const value: unknown = { userId: "abc123",};
assertObjectMatches(value, { userId: nonNullable(),});
// value is now narrowed to an object with a non-null, non-undefined userId// {// userId: NonNullable<unknown>;// }Source
Section titled “Source”Source file: src/assert/non-nullable/non-nullable.match.ts
