mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
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:
parent
2f53935499
commit
9146215a24
13
types/json-schema-generator/index.d.ts
vendored
Normal file
13
types/json-schema-generator/index.d.ts
vendored
Normal 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;
|
||||
@ -0,0 +1,5 @@
|
||||
import jsonToSchema = require("json-schema-generator");
|
||||
|
||||
const obj = jsonToSchema({a: 4}); // $ExpectType JSONSchema4
|
||||
|
||||
const withString = jsonToSchema("{a: 4}"); // $ExpectError
|
||||
23
types/json-schema-generator/tsconfig.json
Normal file
23
types/json-schema-generator/tsconfig.json
Normal 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"
|
||||
]
|
||||
}
|
||||
1
types/json-schema-generator/tslint.json
Normal file
1
types/json-schema-generator/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user