Skip to content

Commit 58555af

Browse files
kibertoadkobik
authored andcommitted
Clarify TS types for errors (#76)
* Fix incorrect typing for errors * Clarify typing
1 parent d6c3169 commit 58555af

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

types/index.d.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,17 @@ export function init(swaggerPath: string, options?: ajvValidatorOptions): Promis
1515
export function validate(req: object, res: object, next: Function): void;
1616

1717
export class InputValidationError extends Error {
18-
errors: Array<string>;
18+
errors: Array<ErrorDetails | string>;
1919

20-
constructor(errors: Array<string>, path?: string, method?: string, options?: inputValidationOptions)
20+
constructor(errors: Array<ErrorDetails>, path?: string, method?: string, options?: inputValidationOptions)
21+
}
22+
23+
export interface ErrorDetails {
24+
dataPath: string;
25+
keyword: string;
26+
message: string;
27+
params: Record<string, any>;
28+
schemaPath: string;
2129
}
2230

2331
export enum frameworks {

0 commit comments

Comments
 (0)