Skip to content

dateAfter

Matcher for a Date holding an instant later than the given one.

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

import { assertObjectMatches, dateAfter } from "@kensio/smartass";
const value: unknown = {
dueAt: new Date("2026-06-01T00:00:00.000Z"),
};
assertObjectMatches(value, {
dueAt: dateAfter(new Date("2026-01-01T00:00:00.000Z")),
});
// value is now narrowed to an object with a Date dueAt
// {
// dueAt: Date;
// }

Source file: src/assert/date-after/date-after.match.ts