mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
[whitelist-object] Add types
This commit is contained in:
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// Type definitions for whitelist-object 1.0
|
||||
// Project: https://github.com/conorhastings/whitelist-object#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = whitelistObject;
|
||||
|
||||
declare function whitelistObject(
|
||||
object: { [key: string]: any },
|
||||
keys: ReadonlyArray<string>,
|
||||
shallow?: boolean
|
||||
): { [key: string]: any };
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -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);
|
||||
Reference in New Issue
Block a user