Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

type-plus

Package Overview
Dependencies
Maintainers
1
Versions
169
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

type-plus - npm Package Compare versions

Comparing version 1.21.0 to 1.21.1

3

lib/Except.d.ts
import { Omit } from './Omit';
import { UnionKeys } from './UnionKeys';
/**
* @deprecated replaced by `Omit`
*/
export declare type Except<T, K extends UnionKeys<T>> = Omit<T, K>;
export declare type Except<T, K extends keyof T> = Omit<T, K>;

@@ -1,2 +0,1 @@

import { UnionKeys } from './UnionKeys';
export declare type Omit<T, K extends UnionKeys<T>> = T extends T ? Pick<T, Exclude<keyof T, K>> : never;
export declare type Omit<T, K extends keyof T> = T extends T ? Pick<T, Exclude<keyof T, K>> : never;

@@ -1,16 +0,15 @@

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 ? {
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>;
export declare type Pick<T, K extends keyof T> = T extends T ? {
[P in K]: T[P];
} : never;
import { Omit } from './Omit';
import { UnionKeys } from './UnionKeys';
/**
* @deprecated replaced by `Omit`
*/
export declare type Except<T, K extends UnionKeys<T>> = Omit<T, K>;
export declare type Except<T, K extends keyof T> = Omit<T, K>;

@@ -1,2 +0,1 @@

import { UnionKeys } from './UnionKeys';
export declare type Omit<T, K extends UnionKeys<T>> = T extends T ? Pick<T, Exclude<keyof T, K>> : never;
export declare type Omit<T, K extends keyof T> = T extends T ? Pick<T, Exclude<keyof T, K>> : never;

@@ -1,16 +0,15 @@

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 ? {
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>;
export declare type Pick<T, K extends keyof T> = T extends T ? {
[P in K]: T[P];
} : never;
{
"name": "type-plus",
"version": "1.21.0",
"version": "1.21.1",
"description": "Provides additional types for `typescript`.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/unional/type-plus",

import { Omit } from './Omit';
import { UnionKeys } from './UnionKeys';

@@ -7,2 +6,2 @@ /**

*/
export type Except<T, K extends UnionKeys<T>> = Omit<T, K>
export type Except<T, K extends keyof T> = Omit<T, K>

@@ -43,1 +43,9 @@ import { Omit, typeAssert } from '.';

})
test('intersection types with generic', () => {
type Foo = { a: string, b: string }
function foo<T>(input: Omit<Foo & T, 'a'>): void {
typeAssert.isString(input.b)
}
foo({ b: '1' })
})

@@ -1,6 +0,4 @@

import { UnionKeys } from './UnionKeys';
// by Titian Cernicova-Dragomir
// https://github.com/microsoft/TypeScript/issues/28339#issuecomment-463577347
// type-zoo
export type Omit<T, K extends UnionKeys<T>> = T extends T ? Pick<T, Exclude<keyof T, K>> : never;
export type Omit<T, K extends keyof T> = T extends T ? Pick<T, Exclude<keyof T, K>> : never;

@@ -1,2 +0,2 @@

import { Pick, pick } from '.';
import { Pick, pick, typeAssert } from '.';

@@ -30,1 +30,9 @@ test('pick properties from object', () => {

})
test('intersection types with generic', () => {
type Foo = { a: string, b: string }
function foo<T>(input: Pick<Foo & T, 'a'>): void {
typeAssert.isString(input.a)
}
foo({ a: '1' })
})
import { reduceKey } from './reduceKey';
import { UnionKeys } from './UnionKeys';
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, 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>(subject: T, ...props: Array<keyof T>) {

@@ -26,2 +25,2 @@ return reduceKey(subject, (p, k) => {

// 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
export type Pick<T, K extends keyof 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc