Skip to content

Commit 92341fe

Browse files
committed
rename variables
1 parent c610b17 commit 92341fe

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

@@ -159,8 +161,8 @@ export const withSentry = (origHandler: NextApiHandler): WrappedNextApiHandler =
159161
};
160162
};
161163

162-
type ResponseEndMethod = AugmentedResponse['end'];
163-
type WrappedResponseEndMethod = AugmentedResponse['end'];
164+
type ResponseEndMethod = AugmentedNextApiResponse['end'];
165+
type WrappedResponseEndMethod = AugmentedNextApiResponse['end'];
164166

165167
/**
166168
* Wrap `res.end()` so that it closes the transaction and flushes events before letting the request finish.
@@ -173,7 +175,7 @@ type WrappedResponseEndMethod = AugmentedResponse['end'];
173175
* @returns The wrapped version
174176
*/
175177
function wrapEndMethod(origEnd: ResponseEndMethod): WrappedResponseEndMethod {
176-
return async function newEnd(this: AugmentedResponse, ...args: unknown[]) {
178+
return async function newEnd(this: AugmentedNextApiResponse, ...args: unknown[]) {
177179
const transaction = this.__sentryTransaction;
178180

179181
if (transaction) {

0 commit comments

Comments
 (0)