Commit 62aebf8 1 parent a32d81e commit 62aebf8 Copy full SHA for 62aebf8
File tree 1 file changed +4
-10
lines changed
1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -12,20 +12,14 @@ export interface H3Event {
12
12
13
13
export type CompatibilityEvent = H3Event | IncomingMessage
14
14
15
- // interface JSONObject { [x: string]: JSONValue }
16
- // interface JSONArray extends Array<JSONValue> { }
17
- // type JSONValue = undefined | null | string | number | boolean | JSONObject | JSONArray
18
- // type NonNullable<T> = T extends null | undefined ? never : T
19
- // TODO: Find a more reliable way to typecheck Response with complex intefaces
20
- // https://github.com/unjs/h3/issues/112
21
- export type H3Response = any
15
+ export type H3Response < T = any > = T | Promise < T >
22
16
23
- export interface EventHandler < T extends H3Response = H3Response > {
17
+ export interface EventHandler < T = any > {
24
18
'__is_handler__' ?: true
25
- ( event : CompatibilityEvent ) : T
19
+ ( event : CompatibilityEvent ) : H3Response < T >
26
20
}
27
21
28
- export function defineEventHandler < T extends H3Response = H3Response > ( handler : EventHandler < T > ) : EventHandler < T > {
22
+ export function defineEventHandler < T = any > ( handler : EventHandler < T > ) : EventHandler < T > {
29
23
handler . __is_handler__ = true
30
24
return handler
31
25
}
You can’t perform that action at this time.
0 commit comments