mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Merge pull request #32220 from BendingBender/all-keys
[all-keys] Add types
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import allKeys = require('all-keys');
|
||||
|
||||
allKeys(Symbol.prototype); // $ExpectType Set<string>
|
||||
allKeys(Symbol.prototype, { includeObjectPrototype: false }); // $ExpectType Set<string>
|
||||
allKeys(Symbol.prototype, { includeSymbols: false }); // $ExpectType Set<string>
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
// Type definitions for all-keys 2.0
|
||||
// Project: https://github.com/sindresorhus/all-keys#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export = allKeys;
|
||||
|
||||
/**
|
||||
* Get all property keys of an object including non-enumerable and inherited ones.
|
||||
* Like [Reflect.ownKeys()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/ownKeys)
|
||||
* but traverses up the prototype-chain.
|
||||
*/
|
||||
declare function allKeys(obj: object, options?: allKeys.Options): Set<string>;
|
||||
|
||||
declare namespace allKeys {
|
||||
interface Options {
|
||||
/**
|
||||
* Include `Object.prototype` properties like `isPrototypeOf`.
|
||||
* @default true
|
||||
*/
|
||||
includeObjectPrototype?: boolean;
|
||||
/**
|
||||
* Include [Symbol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) keys.
|
||||
* @default true
|
||||
*/
|
||||
includeSymbols?: boolean;
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
"all-keys-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user