oneOf
Matcher for a value that is one of a set of expected values.
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, oneOf } from "@kensio/smartass";
const value: unknown = { role: "admin",};
assertObjectMatches(value, { role: oneOf(["admin", "editor"] as const),});
// value is now narrowed to an object with a known role// {// role: "admin" | "editor";// }Source
Section titled “Source”Source file: src/assert/one-of/one-of.match.ts
