Skip to content

assertSetSize

Assert that a Set has exactly the expected size, with type narrowing.

import { assertSetSize } from "@kensio/smartass";
const value: unknown = new Set(["admin"]);
assertSetSize(value, 1);
// value is now narrowed to a Set with exactly 1 element

Source file: src/assert/set-size/set-size.assert.ts