mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Define Rest<T, K> as Pick<T, Exclude<keyof T, K>> to ensure it is homomorphic
This commit is contained in:
12
src/lib/es5.d.ts
vendored
12
src/lib/es5.d.ts
vendored
@@ -1416,13 +1416,6 @@ type Pick<T, K extends keyof T> = {
|
||||
[P in K]: T[P];
|
||||
};
|
||||
|
||||
/**
|
||||
* From T, omit a set of properties whose keys are in the union K
|
||||
*/
|
||||
type Rest<T, K extends keyof T> = {
|
||||
[P in Exclude<keyof T, K>]: T[P];
|
||||
};
|
||||
|
||||
/**
|
||||
* Construct a type with a set of properties K of type T
|
||||
*/
|
||||
@@ -1445,6 +1438,11 @@ type Extract<T, U> = T extends U ? T : never;
|
||||
*/
|
||||
type NonNullable<T> = T extends null | undefined ? never : T;
|
||||
|
||||
/**
|
||||
* From T, pick all properties except those in the union K
|
||||
*/
|
||||
type Rest<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
||||
|
||||
/**
|
||||
* Obtain the parameters of a function type in a tuple
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user