mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add types for object-inspect@1.4
This commit add type declarations for `object-inspect`. Related: - https://github.com/substack/object-inspect/pull/17
This commit is contained in:
parent
1a051f0000
commit
63c0b20f2c
27
types/object-inspect/index.d.ts
vendored
Normal file
27
types/object-inspect/index.d.ts
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
// Type definitions for object-inspect 1.4
|
||||
// Project: https://github.com/substack/object-inspect
|
||||
// Definitions by: Charles Samborski <https://github.com/demurgos>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace objectInspect {
|
||||
/**
|
||||
* Inspection options
|
||||
*/
|
||||
interface Options {
|
||||
/**
|
||||
* Maximum depth of the inspection. Default: `5`.
|
||||
*/
|
||||
depth?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string `s` with the string representation of `obj` up to a depth of `opts.depth`.
|
||||
*
|
||||
* @param obj Object to inspect
|
||||
* @param opts Inspection options. Default: `{}`.
|
||||
* @return String representation of `obj`
|
||||
*/
|
||||
declare function objectInspect(obj: any, opts?: objectInspect.Options): string;
|
||||
|
||||
export = objectInspect;
|
||||
10
types/object-inspect/object-inspect-tests.ts
Normal file
10
types/object-inspect/object-inspect-tests.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import objectInspect = require('object-inspect');
|
||||
|
||||
// $ExpectType string
|
||||
objectInspect({foo: "bar"});
|
||||
|
||||
// $ExpectType string
|
||||
objectInspect({foo: "bar"}, {});
|
||||
|
||||
// $ExpectType string
|
||||
objectInspect({foo: "bar"}, {depth: Infinity});
|
||||
23
types/object-inspect/tsconfig.json
Normal file
23
types/object-inspect/tsconfig.json
Normal file
@ -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",
|
||||
"object-inspect-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/object-inspect/tslint.json
Normal file
1
types/object-inspect/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user