@@ -24,7 +24,7 @@ export interface OnoConstructor {
2424 * Returns an object containing all properties of the given Error object,
2525 * which can be used with `JSON.stringify()`.
2626 */
27- toJSON < E extends ErrorLike > ( error : E ) : ErrorPOJO & E ;
27+ toJSON < T extends ErrorLike > ( error : T ) : T & ErrorPOJO ;
2828
2929 /**
3030 * Extends the given Error object with enhanced Ono functionality, such as improved support for
@@ -41,7 +41,7 @@ export interface OnoConstructor {
4141 * @param error - The error object to extend. This object instance will be modified and returned.
4242 * @param props - An object whose properties will be added to the error
4343 */
44- extend < T extends ErrorLike , P extends object > ( error : T , props ?: P ) : T & P & OnoError < T & P > ;
44+ extend < TError extends ErrorLike , TProps extends object > ( error : TError , props ?: TProps ) : TError & TProps & OnoError < TError & TProps > ;
4545
4646 /**
4747 * Extends the given Error object with enhanced Ono functionality, such as nested stack traces
@@ -50,7 +50,7 @@ export interface OnoConstructor {
5050 * @param error - The error object to extend. This object instance will be modified and returned.
5151 * @param originalError - The original error. This error's stack trace will be added to the error's stack trace.
5252 */
53- extend < T extends ErrorLike , E extends ErrorLike > ( error : T , originalError ?: E ) : T & E & OnoError < T & E > ;
53+ extend < TError extends ErrorLike , TOriginal extends ErrorLike > ( error : TError , originalError ?: TOriginal ) : TError & TOriginal & OnoError < TError & TOriginal > ;
5454
5555 /**
5656 * Extends the given Error object with enhanced Ono functionality, such as nested stack traces,
@@ -60,7 +60,7 @@ export interface OnoConstructor {
6060 * @param originalError - The original error. This error's stack trace will be added to the error's stack trace.
6161 * @param props - An object whose properties will be added to the error
6262 */
63- extend < T extends ErrorLike , E extends ErrorLike , P extends object > ( error : T , originalError ?: E , props ?: P ) : T & E & P & OnoError < T & E & P > ;
63+ extend < TError extends ErrorLike , TOriginal extends ErrorLike , TProps extends object > ( error : TError , originalError ?: TOriginal , props ?: TProps ) : TError & TOriginal & TProps & OnoError < TError & TOriginal & TProps > ;
6464}
6565
6666/**
@@ -77,7 +77,7 @@ export interface Ono<T extends ErrorLike> {
7777 *
7878 * @param error - The original error
7979 */
80- < E extends ErrorLike > ( error : E ) : T & E & OnoError < T & E > ;
80+ < TError extends ErrorLike > ( error : TError ) : T & TError & OnoError < T & TError > ;
8181
8282 /**
8383 * Creates a new error with the message, stack trace, and properties of another error,
@@ -86,7 +86,7 @@ export interface Ono<T extends ErrorLike> {
8686 * @param error - The original error
8787 * @param props - An object whose properties will be added to the returned error
8888 */
89- < E extends ErrorLike , P extends object > ( error : E , props : P ) : T & E & P & OnoError < T & E & P > ;
89+ < TError extends ErrorLike , TProps extends object > ( error : TError , props : TProps ) : T & TError & TProps & OnoError < T & TError & TProps > ;
9090
9191 /**
9292 * Creates a new error with a formatted message and the stack trace and properties of another error.
@@ -95,7 +95,7 @@ export interface Ono<T extends ErrorLike> {
9595 * @param message - The new error message, possibly including argument placeholders
9696 * @param params - Optional arguments to replace the corresponding placeholders in the message
9797 */
98- < E extends ErrorLike > ( error : E , message : string , ...params : unknown [ ] ) : T & E & OnoError < T & E > ;
98+ < TError extends ErrorLike > ( error : TError , message : string , ...params : unknown [ ] ) : T & TError & OnoError < T & TError > ;
9999
100100 /**
101101 * Creates a new error with a formatted message and the stack trace and properties of another error,
@@ -106,7 +106,7 @@ export interface Ono<T extends ErrorLike> {
106106 * @param message - The new error message, possibly including argument placeholders
107107 * @param params - Optional arguments to replace the corresponding placeholders in the message
108108 */
109- < E extends ErrorLike , P extends object > ( error : E , props : P , message : string , ...params : unknown [ ] ) : T & E & P & OnoError < T & E & P > ;
109+ < TError extends ErrorLike , TProps extends object > ( error : TError , props : TProps , message : string , ...params : unknown [ ] ) : T & TError & TProps & OnoError < T & TError & TProps > ;
110110
111111 /**
112112 * Creates an error with a formatted message.
@@ -121,7 +121,7 @@ export interface Ono<T extends ErrorLike> {
121121 *
122122 * @param props - An object whose properties will be added to the returned error
123123 */
124- < P extends object > ( props : P ) : T & P & OnoError < T & P > ;
124+ < TProps extends object > ( props : TProps ) : T & TProps & OnoError < T & TProps > ;
125125
126126 /**
127127 * Creates an error with a formatted message and additional properties.
@@ -130,7 +130,7 @@ export interface Ono<T extends ErrorLike> {
130130 * @param message - The new error message, possibly including argument placeholders
131131 * @param params - Optional arguments to replace the corresponding placeholders in the message
132132 */
133- < P extends object > ( props : P , message : string , ...params : unknown [ ] ) : T & P & OnoError < T & P > ;
133+ < TProps extends object > ( props : TProps , message : string , ...params : unknown [ ] ) : T & TProps & OnoError < T & TProps > ;
134134}
135135
136136/**
0 commit comments