diff --git a/types/parse-json/index.d.ts b/types/parse-json/index.d.ts new file mode 100644 index 0000000000..638933ec40 --- /dev/null +++ b/types/parse-json/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for parse-json 4.0 +// Project: https://github.com/sindresorhus/parse-json +// Definitions by: mrmlnc +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function parseJson(input: string | null, filepath?: string): any; +declare function parseJson(input: string | null, reviver: (key: any, value: any) => any, filepath?: string): any; + +export = parseJson; diff --git a/types/parse-json/parse-json-tests.ts b/types/parse-json/parse-json-tests.ts new file mode 100644 index 0000000000..6bd0a55b32 --- /dev/null +++ b/types/parse-json/parse-json-tests.ts @@ -0,0 +1,10 @@ +import parse = require('parse-json'); + +parse(null); +parse('{}'); +parse('{}', 'filepath'); +parse('{}', () => null); +parse('{}', () => null, 'filepath'); + +// $ExpectError +parse(1); diff --git a/types/parse-json/tsconfig.json b/types/parse-json/tsconfig.json new file mode 100644 index 0000000000..448f6787ba --- /dev/null +++ b/types/parse-json/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", + "parse-json-tests.ts" + ] +} diff --git a/types/parse-json/tslint.json b/types/parse-json/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/parse-json/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }