Skip to content

Commit

Permalink
fix: typescript type for patch, put and delete methods
Browse files Browse the repository at this point in the history
  • Loading branch information
smeijer committed Sep 17, 2021
1 parent dbccd6e commit 9641a85
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/handle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ type Handlers<

// The GET request handler, this is the default getServerSideProps
get?: (context: RuntimeContext<Q>) => RuntimeResponse<P>;
} & {
// Body request handlers, awesome to submit forms to!
[Method in HttpMethodWithBody]?: (
context: RuntimeContext<Q> & RequestBody<F>,
) => RuntimeResponse<P>;

// POST request handlers, awesome to submit forms to!
post?: (context: RuntimeContext<Q> & RequestBody<F>) => RuntimeResponse<P>;
put?: (context: RuntimeContext<Q> & RequestBody<F>) => RuntimeResponse<P>;
delete?: (context: RuntimeContext<Q> & RequestBody<F>) => RuntimeResponse<P>;
patch?: (context: RuntimeContext<Q> & RequestBody<F>) => RuntimeResponse<P>;
};

/**
Expand Down

0 comments on commit 9641a85

Please sign in to comment.