mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-14 12:09:04 +08:00
Merge pull request #21447 from mrmlnc/parse_json
[parse-json] Add typings for "parse-json" package
This commit is contained in:
9
types/parse-json/index.d.ts
vendored
Normal file
9
types/parse-json/index.d.ts
vendored
Normal 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;
|
||||
10
types/parse-json/parse-json-tests.ts
Normal file
10
types/parse-json/parse-json-tests.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import parse = require('parse-json');
|
||||
|
||||
parse(null);
|
||||
parse('{}');
|
||||
parse('{}', 'filepath');
|
||||
parse('{}', () => null);
|
||||
parse('{}', () => null, 'filepath');
|
||||
|
||||
// $ExpectError
|
||||
parse(1);
|
||||
23
types/parse-json/tsconfig.json
Normal file
23
types/parse-json/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",
|
||||
"parse-json-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/parse-json/tslint.json
Normal file
1
types/parse-json/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user