mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-10 06:41:59 -06:00
Define Rest<T, K> as Pick<T, Exclude<keyof T, K>> to ensure it is homomorphic
This commit is contained in:
parent
b0a5337604
commit
0b194a2b34
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
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user