Skip to content

greaterThan

Matcher for a numeric value greater than the given value.

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

import { assertObjectMatches, greaterThan } from "@kensio/smartass";
const value: unknown = {
score: 85,
};
assertObjectMatches(value, {
score: greaterThan(0),
});
// value is now narrowed to an object with a positive numeric score
// {
// score: number | bigint;
// }

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