Skip to content

lessThanOrEqual

Matcher for a numeric value less than or equal to the given value.

Matchers are applied through assertObjectMatches, where they narrow the corresponding property type.

import { assertObjectMatches, lessThanOrEqual } from "@kensio/smartass";
const value: unknown = {
errorRate: 0,
};
assertObjectMatches(value, {
errorRate: lessThanOrEqual(0.01),
});
// value is now narrowed to an object with a numeric error rate
// {
// errorRate: number | bigint;
// }

Source file: src/assert/less-than-or-equal/less-than-or-equal.match.ts