Merge pull request #21447 from mrmlnc/parse_json

[parse-json] Add typings for "parse-json" package
This commit is contained in:
Nathan Shively-Sanders
2017-11-13 16:10:59 -08:00
committed by GitHub
4 changed files with 43 additions and 0 deletions

9
types/parse-json/index.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
// Type definitions for parse-json 4.0
// Project: https://github.com/sindresorhus/parse-json
// Definitions by: mrmlnc <https://github.com/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;

View File

@@ -0,0 +1,10 @@
import parse = require('parse-json');
parse(null);
parse('{}');
parse('{}', 'filepath');
parse('{}', () => null);
parse('{}', () => null, 'filepath');
// $ExpectError
parse(1);

View 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",
"parse-json-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }