type-plus
Advanced tools
Comparing version 1.20.1 to 1.21.0
@@ -0,5 +1,6 @@ | ||
import { Omit } from './Omit'; | ||
import { UnionKeys } from './UnionKeys'; | ||
/** | ||
* @deprecated replaced by `Omit` | ||
*/ | ||
export declare type Except<T, K extends keyof T> = Omit<T, K>; | ||
export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; | ||
export declare type Except<T, K extends UnionKeys<T>> = Omit<T, K>; |
@@ -17,2 +17,3 @@ export { required, requiredDeep } from 'unpartial'; | ||
export * from './mapSeries'; | ||
export * from './Omit'; | ||
export * from './Partial'; | ||
@@ -19,0 +20,0 @@ export * from './pick'; |
@@ -1,12 +0,16 @@ | ||
export declare function pick<T extends object, P1 extends keyof T>(subject: T, prop1: P1): Pick<T, P1>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T>(subject: T, prop1: P1, prop2: P2): Pick<T, P1 | P2>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3): Pick<T, P1 | P2 | P3>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4): Pick<T, P1 | P2 | P3 | P4>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5): Pick<T, P1 | P2 | P3 | P4 | P5>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6): Pick<T, P1 | P2 | P3 | P4 | P5 | P6>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T, P7 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T, P7 extends keyof T, P8 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T, P7 extends keyof T, P8 extends keyof T, P9 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T, P7 extends keyof T, P8 extends keyof T, P9 extends keyof T, P10 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9, prop10: P10): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T, P7 extends keyof T, P8 extends keyof T, P9 extends keyof T, P10 extends keyof T, P11 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9, prop10: P10, prop11: P11): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | P11>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T, P7 extends keyof T, P8 extends keyof T, P9 extends keyof T, P10 extends keyof T, P11 extends keyof T, P12 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9, prop10: P10, prop11: P11, prop12: P12): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | P11 | P12>; | ||
import { UnionKeys } from './UnionKeys'; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>>(subject: T, prop1: P1): Pick<T, P1>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2): Pick<T, P1 | P2>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3): Pick<T, P1 | P2 | P3>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4): Pick<T, P1 | P2 | P3 | P4>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5): Pick<T, P1 | P2 | P3 | P4 | P5>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6): Pick<T, P1 | P2 | P3 | P4 | P5 | P6>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>, P7 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>, P7 extends UnionKeys<T>, P8 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>, P7 extends UnionKeys<T>, P8 extends UnionKeys<T>, P9 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>, P7 extends UnionKeys<T>, P8 extends UnionKeys<T>, P9 extends UnionKeys<T>, P10 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9, prop10: P10): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>, P7 extends UnionKeys<T>, P8 extends UnionKeys<T>, P9 extends UnionKeys<T>, P10 extends UnionKeys<T>, P11 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9, prop10: P10, prop11: P11): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | P11>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>, P7 extends UnionKeys<T>, P8 extends UnionKeys<T>, P9 extends UnionKeys<T>, P10 extends UnionKeys<T>, P11 extends UnionKeys<T>, P12 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9, prop10: P10, prop11: P11, prop12: P12): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | P11 | P12>; | ||
export declare type Pick<T, K extends UnionKeys<T>> = T extends T ? { | ||
[P in K]: T[P]; | ||
} : never; |
@@ -0,5 +1,6 @@ | ||
import { Omit } from './Omit'; | ||
import { UnionKeys } from './UnionKeys'; | ||
/** | ||
* @deprecated replaced by `Omit` | ||
*/ | ||
export declare type Except<T, K extends keyof T> = Omit<T, K>; | ||
export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; | ||
export declare type Except<T, K extends UnionKeys<T>> = Omit<T, K>; |
@@ -17,2 +17,3 @@ export { required, requiredDeep } from 'unpartial'; | ||
export * from './mapSeries'; | ||
export * from './Omit'; | ||
export * from './Partial'; | ||
@@ -19,0 +20,0 @@ export * from './pick'; |
@@ -1,12 +0,16 @@ | ||
export declare function pick<T extends object, P1 extends keyof T>(subject: T, prop1: P1): Pick<T, P1>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T>(subject: T, prop1: P1, prop2: P2): Pick<T, P1 | P2>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3): Pick<T, P1 | P2 | P3>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4): Pick<T, P1 | P2 | P3 | P4>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5): Pick<T, P1 | P2 | P3 | P4 | P5>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6): Pick<T, P1 | P2 | P3 | P4 | P5 | P6>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T, P7 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T, P7 extends keyof T, P8 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T, P7 extends keyof T, P8 extends keyof T, P9 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T, P7 extends keyof T, P8 extends keyof T, P9 extends keyof T, P10 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9, prop10: P10): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T, P7 extends keyof T, P8 extends keyof T, P9 extends keyof T, P10 extends keyof T, P11 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9, prop10: P10, prop11: P11): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | P11>; | ||
export declare function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T, P7 extends keyof T, P8 extends keyof T, P9 extends keyof T, P10 extends keyof T, P11 extends keyof T, P12 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9, prop10: P10, prop11: P11, prop12: P12): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | P11 | P12>; | ||
import { UnionKeys } from './UnionKeys'; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>>(subject: T, prop1: P1): Pick<T, P1>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2): Pick<T, P1 | P2>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3): Pick<T, P1 | P2 | P3>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4): Pick<T, P1 | P2 | P3 | P4>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5): Pick<T, P1 | P2 | P3 | P4 | P5>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6): Pick<T, P1 | P2 | P3 | P4 | P5 | P6>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>, P7 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>, P7 extends UnionKeys<T>, P8 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>, P7 extends UnionKeys<T>, P8 extends UnionKeys<T>, P9 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>, P7 extends UnionKeys<T>, P8 extends UnionKeys<T>, P9 extends UnionKeys<T>, P10 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9, prop10: P10): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>, P7 extends UnionKeys<T>, P8 extends UnionKeys<T>, P9 extends UnionKeys<T>, P10 extends UnionKeys<T>, P11 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9, prop10: P10, prop11: P11): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | P11>; | ||
export declare function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>, P7 extends UnionKeys<T>, P8 extends UnionKeys<T>, P9 extends UnionKeys<T>, P10 extends UnionKeys<T>, P11 extends UnionKeys<T>, P12 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9, prop10: P10, prop11: P11, prop12: P12): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | P11 | P12>; | ||
export declare type Pick<T, K extends UnionKeys<T>> = T extends T ? { | ||
[P in K]: T[P]; | ||
} : never; |
{ | ||
"name": "type-plus", | ||
"version": "1.20.1", | ||
"version": "1.21.0", | ||
"description": "Provides additional types for `typescript`.", | ||
@@ -36,2 +36,3 @@ "homepage": "https://github.com/unional/type-plus", | ||
"verify": "npm run lint && npm run build && npm run dependency-check && jest --coverage --reporters=default", | ||
"verify:ci": "npm run lint && npm run build && npm run dependency-check && jest --coverage --reporters=default --maxWorkers=2", | ||
"watch": "jest --watch" | ||
@@ -38,0 +39,0 @@ }, |
@@ -0,1 +1,3 @@ | ||
import { Omit } from './Omit'; | ||
import { UnionKeys } from './UnionKeys'; | ||
@@ -5,4 +7,2 @@ /** | ||
*/ | ||
export type Except<T, K extends keyof T> = Omit<T, K> | ||
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>> | ||
export type Except<T, K extends UnionKeys<T>> = Omit<T, K> |
@@ -17,2 +17,3 @@ export { required, requiredDeep } from 'unpartial'; | ||
export * from './mapSeries'; | ||
export * from './Omit'; | ||
export * from './Partial'; | ||
@@ -19,0 +20,0 @@ export * from './pick'; |
@@ -1,2 +0,2 @@ | ||
import { pick } from '.'; | ||
import { Pick, pick } from '.'; | ||
@@ -8,1 +8,23 @@ test('pick properties from object', () => { | ||
}) | ||
test('distributive pick', () => { | ||
type Action = InvokeAction | ReturnAction | ||
type InvokeAction = { | ||
type: 'invoke', | ||
id: string, | ||
payload: string[] | ||
} | ||
type ReturnAction = { | ||
type: 'return', | ||
id: string, | ||
payload: string | ||
} | ||
let x: Pick<Action, 'type' | 'payload'> = {} as any | ||
let actions: Action[] = [] | ||
actions.push({ ...x, id: '1' }) | ||
}) |
import { reduceKey } from './reduceKey'; | ||
import { UnionKeys } from './UnionKeys'; | ||
export function pick<T extends object, P1 extends keyof T>(subject: T, prop1: P1): Pick<T, P1> | ||
export function pick<T extends object, P1 extends keyof T, P2 extends keyof T>(subject: T, prop1: P1, prop2: P2): Pick<T, P1 | P2> | ||
export function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3): Pick<T, P1 | P2 | P3> | ||
export function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4): Pick<T, P1 | P2 | P3 | P4> | ||
export function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5): Pick<T, P1 | P2 | P3 | P4 | P5> | ||
export function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6): Pick<T, P1 | P2 | P3 | P4 | P5 | P6> | ||
export function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T, P7 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7> | ||
export function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T, P7 extends keyof T, P8 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8> | ||
export function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T, P7 extends keyof T, P8 extends keyof T, P9 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9> | ||
export function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T, P7 extends keyof T, P8 extends keyof T, P9 extends keyof T, P10 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9, prop10: P10): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10> | ||
export function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T, P7 extends keyof T, P8 extends keyof T, P9 extends keyof T, P10 extends keyof T, P11 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9, prop10: P10, prop11: P11): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | P11> | ||
export function pick<T extends object, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T, P4 extends keyof T, P5 extends keyof T, P6 extends keyof T, P7 extends keyof T, P8 extends keyof T, P9 extends keyof T, P10 extends keyof T, P11 extends keyof T, P12 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9, prop10: P10, prop11: P11, prop12: P12): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | P11 | P12> | ||
export function pick<T extends object, P1 extends UnionKeys<T>>(subject: T, prop1: P1): Pick<T, P1> | ||
export function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2): Pick<T, P1 | P2> | ||
export function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3): Pick<T, P1 | P2 | P3> | ||
export function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4): Pick<T, P1 | P2 | P3 | P4> | ||
export function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5): Pick<T, P1 | P2 | P3 | P4 | P5> | ||
export function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6): Pick<T, P1 | P2 | P3 | P4 | P5 | P6> | ||
export function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>, P7 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7> | ||
export function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>, P7 extends UnionKeys<T>, P8 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8> | ||
export function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>, P7 extends UnionKeys<T>, P8 extends UnionKeys<T>, P9 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9> | ||
export function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>, P7 extends UnionKeys<T>, P8 extends UnionKeys<T>, P9 extends UnionKeys<T>, P10 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9, prop10: P10): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10> | ||
export function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>, P7 extends UnionKeys<T>, P8 extends UnionKeys<T>, P9 extends UnionKeys<T>, P10 extends UnionKeys<T>, P11 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9, prop10: P10, prop11: P11): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | P11> | ||
export function pick<T extends object, P1 extends UnionKeys<T>, P2 extends UnionKeys<T>, P3 extends UnionKeys<T>, P4 extends UnionKeys<T>, P5 extends UnionKeys<T>, P6 extends UnionKeys<T>, P7 extends UnionKeys<T>, P8 extends UnionKeys<T>, P9 extends UnionKeys<T>, P10 extends UnionKeys<T>, P11 extends UnionKeys<T>, P12 extends UnionKeys<T>>(subject: T, prop1: P1, prop2: P2, prop3: P3, prop4: P4, prop5: P5, prop6: P6, prop7: P7, prop8: P8, prop9: P9, prop10: P10, prop11: P11, prop12: P12): Pick<T, P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | P11 | P12> | ||
export function pick<T extends object>(subject: T, ...props: Array<keyof T>) { | ||
@@ -21,1 +22,6 @@ return reduceKey(subject, (p, k) => { | ||
} | ||
// by Titian Cernicova-Dragomir | ||
// https://github.com/microsoft/TypeScript/issues/28339#issuecomment-463577347 | ||
export type Pick<T, K extends UnionKeys<T>> = T extends T ? { [P in K]: T[P] } : never |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
98289
240
1547