mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-30 06:12:06 -07:00
fix: use variadic array type for MockDate constructor args
TS2367: fixed-length tuple made args.length === 0 unreachable.
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user