Add type for ajv-keywords (#39948)

This commit is contained in:
lochiego 2019-11-01 17:48:24 -05:00 committed by Jesse Trinity
parent ea40bbb6b2
commit efce94ec94
5 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,5 @@
import Ajv from 'ajv';
import defineKeywords = require('ajv-keywords');
let ajv = new Ajv();
ajv = defineKeywords(ajv);

19
types/ajv-keywords/index.d.ts vendored Normal file
View File

@ -0,0 +1,19 @@
// Type definitions for ajv-keywords 3.4
// Project: https://github.com/epoberezkin/ajv-keywords#readme
// Definitions by: Eric Gonzalez <https://github.com/lochiego>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.7
import { Ajv } from "ajv";
export { };
/**
* Defines one or several keywords in ajv instance
* @param ajv validator instance
* @param keywords keyword(s) to define
* @return ajv instance (for chaining)
*/
declare function defineKeywords(ajv: Ajv, keywords?: string | ReadonlyArray<string>): Ajv;
export = defineKeywords;

View File

@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"ajv": "^6.9.1"
}
}

View File

@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true
},
"files": [
"index.d.ts",
"ajv-keywords-tests.ts"
]
}

View File

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