Add types for json-dup-key-validator (#45543)

This commit is contained in:
Jamie Magee 2020-06-21 10:10:52 +02:00 committed by GitHub
parent 2b693605f3
commit 1e67ae1a43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,7 @@
// Type definitions for json-dup-key-validator 1.0
// Project: https://github.com/jackyjieliu/json-dup-key-validator
// Definitions by: Jamie Magee <https://github.com/JamieMagee>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export function validate(jsonString: string, allowDuplicatedKeys?: boolean): string | undefined;
export function parse(jsonString: string, allowDuplicatedKeys?: boolean): object;

View File

@ -0,0 +1,6 @@
import * as jsonValidator from 'json-dup-key-validator';
jsonValidator.parse('{}'); // $ExpectType object
jsonValidator.parse('{}', false); // $ExpectType object
jsonValidator.validate('{}'); // $ExpectType string | undefined
jsonValidator.validate('{}', false); // $ExpectType string | undefined

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"json-dup-key-validator-tests.ts"
]
}

View File

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