Add definitions for json-schema-generator (#47272)

* Add definitions for json-schema-generator

* fix tests

* Incorporate PR feedback

* Fix formatting
This commit is contained in:
Marcell Toth 2020-09-08 13:45:51 +02:00 committed by GitHub
parent 2f53935499
commit 9146215a24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 0 deletions

13
types/json-schema-generator/index.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
// Type definitions for json-schema-generator 2.0
// Project: https://github.com/krg7880/json-schema-generator
// Definitions by: Marcell Toth <https://github.com/marcelltoth>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { JSONSchema4 } from 'json-schema';
export = jsonToSchema;
/**
* JSON schema generated based on draft-v4 of the specification.
*/
declare function jsonToSchema(schema: object): JSONSchema4;

View File

@ -0,0 +1,5 @@
import jsonToSchema = require("json-schema-generator");
const obj = jsonToSchema({a: 4}); // $ExpectType JSONSchema4
const withString = jsonToSchema("{a: 4}"); // $ExpectError

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-schema-generator-tests.ts"
]
}

View File

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