diff --git a/types/object-inspect/index.d.ts b/types/object-inspect/index.d.ts new file mode 100644 index 0000000000..ed72d3266a --- /dev/null +++ b/types/object-inspect/index.d.ts @@ -0,0 +1,27 @@ +// Type definitions for object-inspect 1.4 +// Project: https://github.com/substack/object-inspect +// Definitions by: Charles Samborski +// 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; diff --git a/types/object-inspect/object-inspect-tests.ts b/types/object-inspect/object-inspect-tests.ts new file mode 100644 index 0000000000..22a1e4ab56 --- /dev/null +++ b/types/object-inspect/object-inspect-tests.ts @@ -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}); diff --git a/types/object-inspect/tsconfig.json b/types/object-inspect/tsconfig.json new file mode 100644 index 0000000000..1f167ba039 --- /dev/null +++ b/types/object-inspect/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", + "object-inspect-tests.ts" + ] +} diff --git a/types/object-inspect/tslint.json b/types/object-inspect/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/object-inspect/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }