Skip to content

lessThan

Matcher for a numeric value less than the given value.

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

import { assertObjectMatches, lessThan } from "@kensio/smartass";
const value: unknown = {
retrievability: 0.42,
};
assertObjectMatches(value, {
retrievability: lessThan(1),
});
// value is now narrowed to an object with a numeric retrievability
// {
// retrievability: number | bigint;
// }

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