@@ -19,7 +19,7 @@ import { hasProp } from "./utils/internal/object";
19
19
* This can be used to pass additional information about the error.
20
20
* @property {boolean } internal - Setting this property to `true` will mark the error as an internal error.
21
21
*/
22
- export class H3Error < DataT = any > extends Error {
22
+ export class H3Error < DataT = unknown > extends Error {
23
23
static __h3_error__ = true ;
24
24
statusCode = 500 ;
25
25
fatal = false ;
@@ -64,16 +64,16 @@ export class H3Error<DataT = any> extends Error {
64
64
* @param input {string | (Partial<H3Error> & { status?: number; statusText?: string }) } - The error message or an object containing error properties.
65
65
* @return {H3Error } - An instance of H3Error.
66
66
*/
67
- export function createError < DataT = any > (
67
+ export function createError < DataT = unknown > (
68
68
input :
69
69
| string
70
70
| ( Partial < H3Error < DataT > > & { status ?: number ; statusText ?: string } ) ,
71
- ) : H3Error {
71
+ ) {
72
72
if ( typeof input === "string" ) {
73
73
return new H3Error < DataT > ( input ) ;
74
74
}
75
75
76
- if ( isError ( input ) ) {
76
+ if ( isError < DataT > ( input ) ) {
77
77
return input ;
78
78
}
79
79
@@ -177,6 +177,6 @@ export function sendError(
177
177
* @param input {*} - The input to check.
178
178
* @return {boolean } - Returns true if the input is an instance of H3Error, false otherwise.
179
179
*/
180
- export function isError ( input : any ) : input is H3Error {
180
+ export function isError < DataT = unknown > ( input : any ) : input is H3Error < DataT > {
181
181
return input ?. constructor ?. __h3_error__ === true ;
182
182
}
0 commit comments