From 7071875abefc917c63a9214b15c5dadaf757ed89 Mon Sep 17 00:00:00 2001 From: Alec Larson <1925840+aleclarson@users.noreply.github.com> Date: Thu, 12 Nov 2020 21:43:46 -0500 Subject: [PATCH] fix: stop using @types/node in @sentry/hub Fixes #2927 --- packages/hub/src/interfaces.ts | 13 ++++--------- packages/hub/tsconfig.json | 2 +- packages/tracing/src/hubextensions.ts | 4 +--- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/packages/hub/src/interfaces.ts b/packages/hub/src/interfaces.ts index ddaf71c80c06..4e758401e7b0 100644 --- a/packages/hub/src/interfaces.ts +++ b/packages/hub/src/interfaces.ts @@ -1,5 +1,4 @@ import { Client } from '@sentry/types'; -import * as domain from 'domain'; import { Hub } from './hub'; import { Scope } from './scope'; @@ -25,13 +24,7 @@ export interface Carrier { */ extensions?: { /** Hack to prevent bundlers from breaking our usage of the domain package in the cross-platform Hub package */ - domain?: typeof domain & { - /** - * The currently active domain. This is part of the domain package, but for some reason not declared in the - * package's typedef. - */ - active?: domain.Domain; - }; + domain?: { [key: string]: any }; } & { /** Extension methods for the hub, which are bound to the current Hub instance */ // eslint-disable-next-line @typescript-eslint/ban-types @@ -40,4 +33,6 @@ export interface Carrier { }; } -export interface DomainAsCarrier extends domain.Domain, Carrier {} +export interface DomainAsCarrier extends Carrier { + members: { [key: string]: any }[]; +} diff --git a/packages/hub/tsconfig.json b/packages/hub/tsconfig.json index 55b38e135ae2..7e01ba4e464b 100644 --- a/packages/hub/tsconfig.json +++ b/packages/hub/tsconfig.json @@ -4,6 +4,6 @@ "exclude": ["dist"], "compilerOptions": { "rootDir": ".", - "types": ["node", "jest"] + "types": ["jest"] } } diff --git a/packages/tracing/src/hubextensions.ts b/packages/tracing/src/hubextensions.ts index 118ef67587c9..b083258a4bdc 100644 --- a/packages/tracing/src/hubextensions.ts +++ b/packages/tracing/src/hubextensions.ts @@ -140,9 +140,7 @@ function getDefaultSamplingContext(transactionContext: TransactionContext): Samp // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access const requestType = nodeHttpModule.IncomingMessage; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const request = domain.members.find((member: any) => isInstanceOf(member, requestType)); - + const request = domain.members.find(member => isInstanceOf(member, requestType)); if (request) { defaultSamplingContext.request = extractNodeRequestData(request); }