Unverified Commit 0a5cc30e authored by Pierre de la Martinière's avatar Pierre de la Martinière Committed by GitHub

Add NextApiHandler type (#10573)

* Add NextApiHandler type

* Fix formatting
Co-authored-by: 's avatarJoe Haddad <timer150@gmail.com>
parent db04cc57
......@@ -219,6 +219,14 @@ export type NextApiResponse<T = any> = ServerResponse & {
clearPreviewData: () => NextApiResponse<T>
}
/**
* Next `API` route handler
*/
export type NextApiHandler<T = any> = (
req: NextApiRequest,
res: NextApiResponse<T>
) => void
/**
* Utils
*/
......
......@@ -9,6 +9,7 @@ import {
NextComponentType,
NextApiResponse,
NextApiRequest,
NextApiHandler,
// @ts-ignore This path is generated at build time and conflicts otherwise
} from '../dist/next-server/lib/utils'
......@@ -53,6 +54,12 @@ export type PageConfig = {
}
}
export { NextPageContext, NextComponentType, NextApiResponse, NextApiRequest }
export {
NextPageContext,
NextComponentType,
NextApiResponse,
NextApiRequest,
NextApiHandler,
}
export default next
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment