tryo 0.13.5 → 0.13.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.cts +11 -2
- package/dist/index.d.ts +11 -2
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -460,10 +460,19 @@ declare class ErrorMapper<T, C extends string> {
|
|
|
460
460
|
declare const errorRule: {
|
|
461
461
|
readonly when: <T>(predicate: (err: unknown) => err is T) => ErrorRuleBuilder<T>;
|
|
462
462
|
readonly instance: {
|
|
463
|
-
<T extends abstract new (...args: never[]) => unknown>(ErrorClass: T):
|
|
463
|
+
<T extends abstract new (...args: never[]) => unknown>(ErrorClass: T): InstanceType<T> extends Error & {
|
|
464
|
+
readonly code: string;
|
|
465
|
+
readonly title?: string;
|
|
466
|
+
readonly meta?: Record<string, unknown>;
|
|
467
|
+
readonly status?: number;
|
|
468
|
+
readonly retryable?: boolean;
|
|
469
|
+
readonly raw?: unknown;
|
|
470
|
+
readonly path?: string;
|
|
471
|
+
readonly cause?: unknown;
|
|
472
|
+
} ? ErrorRule<AnyTypedError> & {
|
|
464
473
|
toCode: <const C extends string>(code: C) => ErrorMapper<InstanceType<T>, C>;
|
|
465
474
|
toError: <const Out extends ErrorResponse>(mapper: (err: InstanceType<T>) => Out & Record<Exclude<keyof Out, keyof ErrorResponse>, never>) => ErrorRule<TypedError<Out["code"], Out["meta"] extends Record<string, unknown> ? Out["meta"] : Record<string, unknown>, Out["raw"] extends undefined ? InstanceType<T> : Out["raw"]>>;
|
|
466
|
-
}
|
|
475
|
+
} : ErrorRuleBuilder<InstanceType<T>>;
|
|
467
476
|
<T extends abstract new (...args: never[]) => unknown, const Out extends ErrorResponse>(ErrorClass: T, mapper: (err: InstanceType<T>) => Out & Record<Exclude<keyof Out, keyof ErrorResponse>, never>): ErrorRule<TypedError<Out["code"], Out["meta"] extends Record<string, unknown> ? Out["meta"] : Record<string, unknown>, Out["raw"] extends undefined ? InstanceType<T> : Out["raw"]>>;
|
|
468
477
|
};
|
|
469
478
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -460,10 +460,19 @@ declare class ErrorMapper<T, C extends string> {
|
|
|
460
460
|
declare const errorRule: {
|
|
461
461
|
readonly when: <T>(predicate: (err: unknown) => err is T) => ErrorRuleBuilder<T>;
|
|
462
462
|
readonly instance: {
|
|
463
|
-
<T extends abstract new (...args: never[]) => unknown>(ErrorClass: T):
|
|
463
|
+
<T extends abstract new (...args: never[]) => unknown>(ErrorClass: T): InstanceType<T> extends Error & {
|
|
464
|
+
readonly code: string;
|
|
465
|
+
readonly title?: string;
|
|
466
|
+
readonly meta?: Record<string, unknown>;
|
|
467
|
+
readonly status?: number;
|
|
468
|
+
readonly retryable?: boolean;
|
|
469
|
+
readonly raw?: unknown;
|
|
470
|
+
readonly path?: string;
|
|
471
|
+
readonly cause?: unknown;
|
|
472
|
+
} ? ErrorRule<AnyTypedError> & {
|
|
464
473
|
toCode: <const C extends string>(code: C) => ErrorMapper<InstanceType<T>, C>;
|
|
465
474
|
toError: <const Out extends ErrorResponse>(mapper: (err: InstanceType<T>) => Out & Record<Exclude<keyof Out, keyof ErrorResponse>, never>) => ErrorRule<TypedError<Out["code"], Out["meta"] extends Record<string, unknown> ? Out["meta"] : Record<string, unknown>, Out["raw"] extends undefined ? InstanceType<T> : Out["raw"]>>;
|
|
466
|
-
}
|
|
475
|
+
} : ErrorRuleBuilder<InstanceType<T>>;
|
|
467
476
|
<T extends abstract new (...args: never[]) => unknown, const Out extends ErrorResponse>(ErrorClass: T, mapper: (err: InstanceType<T>) => Out & Record<Exclude<keyof Out, keyof ErrorResponse>, never>): ErrorRule<TypedError<Out["code"], Out["meta"] extends Record<string, unknown> ? Out["meta"] : Record<string, unknown>, Out["raw"] extends undefined ? InstanceType<T> : Out["raw"]>>;
|
|
468
477
|
};
|
|
469
478
|
};
|