Skip to content

Commit 45b8c83

Browse files
authored
Fix equal() type (#174)
1 parent fb38df0 commit 45b8c83

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/index.d.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ type Class<T = any> = new (...args: any[]) => T;
99

1010
type UnpackArray<T> = T extends (infer U)[] ? U : T;
1111

12-
type RecursivePartial<T> = {
12+
type RecursivePartial<T> = T extends object ? {
1313
[P in keyof T]?:
14-
T[P] extends (infer U)[] ? RecursivePartial<U>[] :
15-
T[P] extends object ? RecursivePartial<T[P]> :
16-
T[P];
17-
};
14+
T[P] extends Array<infer I> ? Array<RecursivePartial<I>> :
15+
RecursivePartial<T[P]>;
16+
} : T;
1817

1918
type Loosely<T> = T extends object ? RecursivePartial<T> & { [key: string]: any } : T;
2019

@@ -348,7 +347,7 @@ declare namespace expect {
348347
*
349348
* @returns assertion chain object.
350349
*/
351-
equal(value: Loosely<T>, options?: Hoek.deepEqual.Options): Assertion<T>;
350+
equal(value: RecursivePartial<T>, options?: Hoek.deepEqual.Options): Assertion<T>;
352351

353352
/**
354353
* Asserts that the reference value equals the provided value.
@@ -358,7 +357,7 @@ declare namespace expect {
358357
*
359358
* @returns assertion chain object.
360359
*/
361-
equals(value: Loosely<T>, options?: Hoek.deepEqual.Options): Assertion<T>;
360+
equals(value: RecursivePartial<T>, options?: Hoek.deepEqual.Options): Assertion<T>;
362361

363362
/**
364363
* Asserts that the reference value has the provided instanceof value.

0 commit comments

Comments
 (0)