未验证 提交 0a5cc30e 编写于 作者: P Pierre de la Martinière 提交者: GitHub

Add NextApiHandler type (#10573)

* Add NextApiHandler type

* Fix formatting
Co-authored-by: NJoe Haddad <timer150@gmail.com>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册