feat: add types for object.pick

This commit is contained in:
Ifiok Jr 2019-04-14 11:43:41 +01:00
parent 6a5529e838
commit fb65ca2f8e
No known key found for this signature in database
GPG Key ID: 8EF46CD5738DCC1B
4 changed files with 42 additions and 0 deletions

15
types/object.pick/index.d.ts vendored Normal file
View File

@ -0,0 +1,15 @@
// Type definitions for object.pick 1.3
// Project: https://github.com/jonschlinkert/object.pick
// Definitions by: Ifiok Jr. <https://github.com/ifiokjr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
/**
* Returns a filtered copy of an object with only the specified keys, similar to `_.pick` from lodash / underscore.
*
* @param object
* @param keys
*/
declare function pick<T extends object, U extends keyof T>(object: T, keys: U[]): Pick<T, U>;
export = pick;

View File

@ -0,0 +1,3 @@
import pick = require('object.pick');
pick({a: 'a', b: 'b'}, ['a']);

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"strictFunctionTypes": true,
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"object.pick-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }