Skip to content

Commit b5d9e22

Browse files
committed
Include constructor TS types for Error classes
1 parent 914c164 commit b5d9e22

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

lib/index.d.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,11 +408,12 @@ declare namespace $RefParser {
408408
export type JSONParserErrorType = "EUNKNOWN" | "EPARSER" | "EUNMATCHEDPARSER" | "ERESOLVER" | "EUNMATCHEDRESOLVER" | "EMISSINGPOINTER" | "EINVALIDPOINTER";
409409

410410
export class JSONParserError extends Error {
411+
constructor(message: string, source: string);
412+
411413
readonly name: string;
412414
readonly message: string;
413415
readonly source: string;
414416
readonly path: Array<string | number>;
415-
readonly errors: string;
416417
readonly code: JSONParserErrorType;
417418
}
418419

@@ -438,27 +439,39 @@ declare namespace $RefParser {
438439
}
439440

440441
export class ParserError extends JSONParserError {
442+
constructor(message: string, source: string);
443+
441444
readonly name = "ParserError";
442445
readonly code = "EPARSER";
443446
}
444447
export class UnmatchedParserError extends JSONParserError {
448+
constructor(source: string);
449+
445450
readonly name = "UnmatchedParserError";
446451
readonly code ="EUNMATCHEDPARSER";
447452
}
448453
export class ResolverError extends JSONParserError {
454+
constructor(ex: Error | NodeJS.ErrnoException, source: string);
455+
449456
readonly name = "ResolverError";
450457
readonly code ="ERESOLVER";
451458
readonly ioErrorCode?: string;
452459
}
453460
export class UnmatchedResolverError extends JSONParserError {
461+
constructor(source: string);
462+
454463
readonly name = "UnmatchedResolverError";
455464
readonly code ="EUNMATCHEDRESOLVER";
456465
}
457466
export class MissingPointerError extends JSONParserError {
467+
constructor(token: string | number, source: string);
468+
458469
readonly name = "MissingPointerError";
459470
readonly code ="EMISSINGPOINTER";
460471
}
461472
export class InvalidPointerError extends JSONParserError {
473+
constructor(pointer: string, source: string);
474+
462475
readonly name = "InvalidPointerError";
463476
readonly code ="EINVALIDPOINTER";
464477
}

0 commit comments

Comments
 (0)