Skip to content

Commit

Permalink
fix(types): nullables object props for response (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu authored Apr 29, 2022
1 parent 46fa4d5 commit 182b224
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ export type CompatibilityEvent = H3Event | IncomingMessage

interface JSONObject { [x: string]: JSONValue }
interface JSONArray extends Array<JSONValue> { }
export type JSONValue = string | number | boolean | JSONObject | JSONArray
export type JSONValue = undefined | null | string | number | boolean | JSONObject | JSONArray
export type NonNullable<T> = T extends null | undefined ? never : T

type _H3Response = void | JSONValue | Buffer
type _H3Response = void | NonNullable<JSONValue> | Buffer
export type H3Response = _H3Response | Promise<_H3Response>

export interface EventHandler<T extends H3Response = H3Response> {
Expand Down

0 comments on commit 182b224

Please sign in to comment.