diff --git a/types/whitelist-object/index.d.ts b/types/whitelist-object/index.d.ts new file mode 100644 index 0000000000..4a11392db9 --- /dev/null +++ b/types/whitelist-object/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for whitelist-object 1.0 +// Project: https://github.com/conorhastings/whitelist-object#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = whitelistObject; + +declare function whitelistObject( + object: { [key: string]: any }, + keys: ReadonlyArray, + shallow?: boolean +): { [key: string]: any }; diff --git a/types/whitelist-object/tsconfig.json b/types/whitelist-object/tsconfig.json new file mode 100644 index 0000000000..bf3050742e --- /dev/null +++ b/types/whitelist-object/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "whitelist-object-tests.ts" + ] +} diff --git a/types/whitelist-object/tslint.json b/types/whitelist-object/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/whitelist-object/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/whitelist-object/whitelist-object-tests.ts b/types/whitelist-object/whitelist-object-tests.ts new file mode 100644 index 0000000000..637525a81d --- /dev/null +++ b/types/whitelist-object/whitelist-object-tests.ts @@ -0,0 +1,15 @@ +import whiteListObject = require('whitelist-object'); + +const myObject = { + cool: 'guy', + conor: 'hastings', + wow: 'so cool', + but: { is: 'he', no: "he isn't" }, +}; + +// $ExpectType { [key: string]: any; } +whiteListObject(myObject, ['cool', 'but', 'is']); +// $ExpectType { [key: string]: any; } +whiteListObject(myObject, ['cool', 'but', 'is'], false); +// $ExpectType { [key: string]: any; } +whiteListObject(myObject, ['cool', 'but', 'is'], true);