Merge pull request #169 from epoberezkin/d-ts-patches

TypeScript: Fix implicit any, fix `Promise` usage
master
Evgeny Poberezkin 2016-04-22 10:18:26 +01:00
commit 91eb1ace40
2 changed files with 10 additions and 6 deletions

14
lib/ajv.d.ts vendored
View File

@ -9,10 +9,14 @@ declare namespace ajv {
addMetaSchema(schema: Object, key?: string): void;
validateSchema(schema: Object): boolean;
getSchema(keyRef: string): ValidateFunction;
removeSchema(schemaKeyRef?: Object | string | RegExp);
removeSchema(schemaKeyRef?: Object | string | RegExp): void;
addFormat(name: string, format: FormatValidator | FormatDefinition): 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 {
@ -21,7 +25,7 @@ declare namespace ajv {
dataPath?: string,
parentData?: Object | Array<any>,
parentDataProperty?: string | number
): boolean | Promise<boolean>;
): boolean | Thenable<boolean>;
errors?: Array<ErrorObject>;
}
@ -36,7 +40,7 @@ declare namespace ajv {
formats?: Object;
schemas?: Array<Object> | Object;
missingRefs?: boolean | string;
loadSchema?: (uri: string, cb: (err, schema) => any) => any;
loadSchema?: (uri: string, cb: (err: Error, schema: Object) => any) => any;
removeAdditional?: boolean | string;
useDefaults?: boolean | string;
coerceTypes?: boolean;
@ -84,7 +88,7 @@ declare namespace ajv {
dataPath?: string,
parentData?: Object | Array<any>,
parentDataProperty?: string | number
): boolean | Promise<boolean>;
): boolean | Thenable<boolean>;
errors?: Array<ErrorObject>;
}

View File

@ -17,7 +17,7 @@
"test-fast": "AJV_FAST_TEST=true npm run test-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-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-regenerator": "./scripts/bundle regenerator",
"bundle-nodent": "./scripts/bundle nodent",