fix: use variadic array type for MockDate constructor args

TS2367: fixed-length tuple made args.length === 0 unreachable.
This commit is contained in:
2026-03-28 10:21:08 -07:00
parent efcacded66
commit b92f253458

View File

@@ -85,14 +85,12 @@ function withMockDate<T>(fixedDate: Date, run: (realDate: typeof Date) => T): T
const realDate = Date;
const fixedDateMs = fixedDate.getTime();
type MockDateArgs = [any, any, any, any, any, any, any];
class MockDate extends Date {
constructor(...args: MockDateArgs) {
constructor(...args: any[]) {
if (args.length === 0) {
super(fixedDateMs);
} else {
super(...args);
super(args[0]);
}
}