Merge pull request #169 from epoberezkin/d-ts-patches
TypeScript: Fix implicit any, fix `Promise` usagemaster
commit
91eb1ace40
|
@ -9,10 +9,14 @@ declare namespace ajv {
|
||||||
addMetaSchema(schema: Object, key?: string): void;
|
addMetaSchema(schema: Object, key?: string): void;
|
||||||
validateSchema(schema: Object): boolean;
|
validateSchema(schema: Object): boolean;
|
||||||
getSchema(keyRef: string): ValidateFunction;
|
getSchema(keyRef: string): ValidateFunction;
|
||||||
removeSchema(schemaKeyRef?: Object | string | RegExp);
|
removeSchema(schemaKeyRef?: Object | string | RegExp): void;
|
||||||
addFormat(name: string, format: FormatValidator | FormatDefinition): void;
|
addFormat(name: string, format: FormatValidator | FormatDefinition): void;
|
||||||
addKeyword(keyword: string, definition: KeywordDefinition): void;
|
addKeyword(keyword: string, definition: KeywordDefinition): void;
|
||||||
errorsText(errors?: Array<ErrorObject>, options?: ErrorsTextOptions);
|
errorsText(errors?: Array<ErrorObject>, options?: ErrorsTextOptions): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Thenable <R> {
|
||||||
|
then <U> (onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ValidateFunction {
|
interface ValidateFunction {
|
||||||
|
@ -21,7 +25,7 @@ declare namespace ajv {
|
||||||
dataPath?: string,
|
dataPath?: string,
|
||||||
parentData?: Object | Array<any>,
|
parentData?: Object | Array<any>,
|
||||||
parentDataProperty?: string | number
|
parentDataProperty?: string | number
|
||||||
): boolean | Promise<boolean>;
|
): boolean | Thenable<boolean>;
|
||||||
errors?: Array<ErrorObject>;
|
errors?: Array<ErrorObject>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +40,7 @@ declare namespace ajv {
|
||||||
formats?: Object;
|
formats?: Object;
|
||||||
schemas?: Array<Object> | Object;
|
schemas?: Array<Object> | Object;
|
||||||
missingRefs?: boolean | string;
|
missingRefs?: boolean | string;
|
||||||
loadSchema?: (uri: string, cb: (err, schema) => any) => any;
|
loadSchema?: (uri: string, cb: (err: Error, schema: Object) => any) => any;
|
||||||
removeAdditional?: boolean | string;
|
removeAdditional?: boolean | string;
|
||||||
useDefaults?: boolean | string;
|
useDefaults?: boolean | string;
|
||||||
coerceTypes?: boolean;
|
coerceTypes?: boolean;
|
||||||
|
@ -84,7 +88,7 @@ declare namespace ajv {
|
||||||
dataPath?: string,
|
dataPath?: string,
|
||||||
parentData?: Object | Array<any>,
|
parentData?: Object | Array<any>,
|
||||||
parentDataProperty?: string | number
|
parentDataProperty?: string | number
|
||||||
): boolean | Promise<boolean>;
|
): boolean | Thenable<boolean>;
|
||||||
errors?: Array<ErrorObject>;
|
errors?: Array<ErrorObject>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
"test-fast": "AJV_FAST_TEST=true npm run test-spec",
|
"test-fast": "AJV_FAST_TEST=true npm run test-spec",
|
||||||
"test-debug": "mocha spec/*.spec.js --debug-brk -R spec",
|
"test-debug": "mocha spec/*.spec.js --debug-brk -R spec",
|
||||||
"test-cov": "istanbul cover -x '**/spec/**' node_modules/mocha/bin/_mocha -- spec/*.spec.js -R spec",
|
"test-cov": "istanbul cover -x '**/spec/**' node_modules/mocha/bin/_mocha -- spec/*.spec.js -R spec",
|
||||||
"test-ts": "tsc --target ES2015 lib/ajv.d.ts",
|
"test-ts": "tsc --target ES5 --noImplicitAny lib/ajv.d.ts",
|
||||||
"bundle": "./scripts/bundle . Ajv pure_getters",
|
"bundle": "./scripts/bundle . Ajv pure_getters",
|
||||||
"bundle-regenerator": "./scripts/bundle regenerator",
|
"bundle-regenerator": "./scripts/bundle regenerator",
|
||||||
"bundle-nodent": "./scripts/bundle nodent",
|
"bundle-nodent": "./scripts/bundle nodent",
|
||||||
|
|
Loading…
Reference in New Issue