Skip to content

Commit 5f756cb

Browse files
dmitriismitnovandrewbranch
authored andcommitted
Add types for ajv-async package (DefinitelyTyped#39140)
* Add types for ajv-async package * Add ts version * Upd dependency * Fix: return Ajv instead of void
1 parent 70eb523 commit 5f756cb

File tree

5 files changed

+45
-0
lines changed

5 files changed

+45
-0
lines changed

types/ajv-async/ajv-async-tests.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import * as Ajv from 'ajv';
2+
import setupAsyncToAJV = require('ajv-async');
3+
4+
const ajv = new Ajv();
5+
setupAsyncToAJV(ajv); // $ExpectType Ajv

types/ajv-async/index.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Type definitions for ajv-async 1.0
2+
// Project: https://github.com/epoberezkin/ajv-async#readme
3+
// Definitions by: es <https://github.com/dmitriismitnov>
4+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5+
// TypeScript Version: 2.2
6+
7+
import { Ajv } from 'ajv';
8+
9+
declare function ajvAsync(ajv: Ajv): Ajv;
10+
export = ajvAsync;

types/ajv-async/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"private": true,
3+
"dependencies": {
4+
"ajv": "*"
5+
}
6+
}

types/ajv-async/tsconfig.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"lib": [
5+
"es6"
6+
],
7+
"noImplicitAny": true,
8+
"noImplicitThis": true,
9+
"strictFunctionTypes": true,
10+
"strictNullChecks": true,
11+
"baseUrl": "../",
12+
"typeRoots": [
13+
"../"
14+
],
15+
"types": [],
16+
"noEmit": true,
17+
"forceConsistentCasingInFileNames": true
18+
},
19+
"files": [
20+
"index.d.ts",
21+
"ajv-async-tests.ts"
22+
]
23+
}

types/ajv-async/tslint.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "extends": "dtslint/dt.json" }

0 commit comments

Comments
 (0)