Skip to content

Commit ebaebb7

Browse files
committed
rename variables
1 parent 8ca6da8 commit ebaebb7

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/nextjs/src/utils/withSentry.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ const { parseRequest } = Handlers;
1010
// purely for clarity
1111
type WrappedNextApiHandler = NextApiHandler;
1212

13-
type AugmentedResponse = NextApiResponse & { __sentryTransaction?: Transaction };
13+
export type AugmentedNextApiResponse = NextApiResponse & {
14+
__sentryTransaction?: Transaction;
15+
};
1416

1517
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1618
export const withSentry = (origHandler: NextApiHandler): WrappedNextApiHandler => {
@@ -69,7 +71,7 @@ export const withSentry = (origHandler: NextApiHandler): WrappedNextApiHandler =
6971

7072
// save a link to the transaction on the response, so that even if there's an error (landing us outside of
7173
// 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;
7375
}
7476
}
7577

@@ -109,11 +111,11 @@ export const withSentry = (origHandler: NextApiHandler): WrappedNextApiHandler =
109111
};
110112
};
111113

112-
type ResponseEndMethod = AugmentedResponse['end'];
113-
type WrappedResponseEndMethod = AugmentedResponse['end'];
114+
type ResponseEndMethod = AugmentedNextApiResponse['end'];
115+
type WrappedResponseEndMethod = AugmentedNextApiResponse['end'];
114116

115117
function wrapEndMethod(origEnd: ResponseEndMethod): WrappedResponseEndMethod {
116-
return async function newEnd(this: AugmentedResponse, ...args: unknown[]) {
118+
return async function newEnd(this: AugmentedNextApiResponse, ...args: unknown[]) {
117119
const transaction = this.__sentryTransaction;
118120

119121
if (transaction) {

0 commit comments

Comments
 (0)