Skip to content

Commit 0b194a2

Browse files
committed
Define Rest<T, K> as Pick<T, Exclude<keyof T, K>> to ensure it is homomorphic
1 parent b0a5337 commit 0b194a2

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/lib/es5.d.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,13 +1416,6 @@ type Pick<T, K extends keyof T> = {
14161416
[P in K]: T[P];
14171417
};
14181418

1419-
/**
1420-
* From T, omit a set of properties whose keys are in the union K
1421-
*/
1422-
type Rest<T, K extends keyof T> = {
1423-
[P in Exclude<keyof T, K>]: T[P];
1424-
};
1425-
14261419
/**
14271420
* Construct a type with a set of properties K of type T
14281421
*/
@@ -1445,6 +1438,11 @@ type Extract<T, U> = T extends U ? T : never;
14451438
*/
14461439
type NonNullable<T> = T extends null | undefined ? never : T;
14471440

1441+
/**
1442+
* From T, pick all properties except those in the union K
1443+
*/
1444+
type Rest<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
1445+
14481446
/**
14491447
* Obtain the parameters of a function type in a tuple
14501448
*/

0 commit comments

Comments
 (0)