File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
packages/nextjs/src/utils Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -10,11 +10,21 @@ import {
1010 stripUrlQueryAndFragment ,
1111} from '@sentry/utils' ;
1212import * as domain from 'domain' ;
13- import { NextApiHandler , NextApiRequest , NextApiResponse } from 'next' ;
14-
15- // This is the same as the `NextApiHandler` type, except instead of having a return type of `void | Promise<void>`, it's
16- // only `Promise<void>`, because wrapped handlers are always async
17- export type WrappedNextApiHandler = ( req : NextApiRequest , res : NextApiResponse ) => Promise < void > ;
13+ import { NextApiRequest , NextApiResponse } from 'next' ;
14+
15+ // These are the same as the official `NextApiHandler` type, except
16+ //
17+ // a) Instead of having a return type of `void | Promise<void>` (Next < 12.1.6) or `unknown | Promise<unknown>` (Next
18+ // 12.1.6+), the unwrapped version has both.
19+ //
20+ // b) The wrapped version returns only promises, because wrapped handlers are always async.
21+ //
22+ // TODO: Fix the need for the multi-version hack. See XXXXXX.
23+ export type NextApiHandler = (
24+ req : NextApiRequest ,
25+ res : NextApiResponse ,
26+ ) => void | Promise < void > | unknown | Promise < unknown > ;
27+ export type WrappedNextApiHandler = ( req : NextApiRequest , res : NextApiResponse ) => Promise < void > | Promise < unknown > ;
1828
1929export type AugmentedNextApiResponse = NextApiResponse & {
2030 __sentryTransaction ?: Transaction ;
You can’t perform that action at this time.
0 commit comments