Skip to content

Commit ff578c7

Browse files
aleclarsonHazAT
andauthored
fix: stop using @types/node in @sentry/hub (#3050)
* fix: stop using @types/node in @sentry/hub Fixes #2927 * fix: Linter Co-authored-by: Daniel Griesser <[email protected]>
1 parent af2c002 commit ff578c7

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

packages/hub/src/interfaces.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Client } from '@sentry/types';
2-
import * as domain from 'domain';
32

43
import { Hub } from './hub';
54
import { Scope } from './scope';
@@ -25,13 +24,8 @@ export interface Carrier {
2524
*/
2625
extensions?: {
2726
/** Hack to prevent bundlers from breaking our usage of the domain package in the cross-platform Hub package */
28-
domain?: typeof domain & {
29-
/**
30-
* The currently active domain. This is part of the domain package, but for some reason not declared in the
31-
* package's typedef.
32-
*/
33-
active?: domain.Domain;
34-
};
27+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
28+
domain?: { [key: string]: any };
3529
} & {
3630
/** Extension methods for the hub, which are bound to the current Hub instance */
3731
// eslint-disable-next-line @typescript-eslint/ban-types
@@ -40,4 +34,7 @@ export interface Carrier {
4034
};
4135
}
4236

43-
export interface DomainAsCarrier extends domain.Domain, Carrier {}
37+
export interface DomainAsCarrier extends Carrier {
38+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
39+
members: { [key: string]: any }[];
40+
}

packages/hub/src/scope.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,12 @@ export class Scope implements ScopeInterface {
477477
* Retruns the global event processors.
478478
*/
479479
function getGlobalEventProcessors(): EventProcessor[] {
480-
const global = getGlobalObject<Window | NodeJS.Global>();
480+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */
481+
const global = getGlobalObject<any>();
481482
global.__SENTRY__ = global.__SENTRY__ || {};
482483
global.__SENTRY__.globalEventProcessors = global.__SENTRY__.globalEventProcessors || [];
483484
return global.__SENTRY__.globalEventProcessors;
485+
/* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */
484486
}
485487

486488
/**

packages/hub/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"exclude": ["dist"],
55
"compilerOptions": {
66
"rootDir": ".",
7-
"types": ["node", "jest"]
7+
"types": ["jest"]
88
}
99
}

packages/tracing/src/hubextensions.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,7 @@ function getDefaultSamplingContext(transactionContext: TransactionContext): Samp
140140
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
141141
const requestType = nodeHttpModule.IncomingMessage;
142142

143-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
144-
const request = domain.members.find((member: any) => isInstanceOf(member, requestType));
145-
143+
const request = domain.members.find(member => isInstanceOf(member, requestType));
146144
if (request) {
147145
defaultSamplingContext.request = extractNodeRequestData(request);
148146
}

0 commit comments

Comments
 (0)