@@ -10,7 +10,9 @@ const { parseRequest } = Handlers;
10
10
// purely for clarity
11
11
type WrappedNextApiHandler = NextApiHandler ;
12
12
13
- type AugmentedResponse = NextApiResponse & { __sentryTransaction ?: Transaction } ;
13
+ export type AugmentedNextApiResponse = NextApiResponse & {
14
+ __sentryTransaction ?: Transaction ;
15
+ } ;
14
16
15
17
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
16
18
export const withSentry = ( origHandler : NextApiHandler ) : WrappedNextApiHandler => {
@@ -69,7 +71,7 @@ export const withSentry = (origHandler: NextApiHandler): WrappedNextApiHandler =
69
71
70
72
// save a link to the transaction on the response, so that even if there's an error (landing us outside of
71
73
// the domain), we can still finish it (albeit possibly missing some scope data)
72
- ( res as AugmentedResponse ) . __sentryTransaction = transaction ;
74
+ ( res as AugmentedNextApiResponse ) . __sentryTransaction = transaction ;
73
75
}
74
76
}
75
77
@@ -109,11 +111,11 @@ export const withSentry = (origHandler: NextApiHandler): WrappedNextApiHandler =
109
111
} ;
110
112
} ;
111
113
112
- type ResponseEndMethod = AugmentedResponse [ 'end' ] ;
113
- type WrappedResponseEndMethod = AugmentedResponse [ 'end' ] ;
114
+ type ResponseEndMethod = AugmentedNextApiResponse [ 'end' ] ;
115
+ type WrappedResponseEndMethod = AugmentedNextApiResponse [ 'end' ] ;
114
116
115
117
function wrapEndMethod ( origEnd : ResponseEndMethod ) : WrappedResponseEndMethod {
116
- return async function newEnd ( this : AugmentedResponse , ...args : unknown [ ] ) {
118
+ return async function newEnd ( this : AugmentedNextApiResponse , ...args : unknown [ ] ) {
117
119
const transaction = this . __sentryTransaction ;
118
120
119
121
if ( transaction ) {
0 commit comments