Skip to content

Commit

Permalink
fix: stop using @types/node in @sentry/hub
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Nov 13, 2020
1 parent af2c002 commit 7071875
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
13 changes: 4 additions & 9 deletions packages/hub/src/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Client } from '@sentry/types';
import * as domain from 'domain';

import { Hub } from './hub';
import { Scope } from './scope';
Expand All @@ -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
Expand All @@ -40,4 +33,6 @@ export interface Carrier {
};
}

export interface DomainAsCarrier extends domain.Domain, Carrier {}
export interface DomainAsCarrier extends Carrier {
members: { [key: string]: any }[];
}
2 changes: 1 addition & 1 deletion packages/hub/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"exclude": ["dist"],
"compilerOptions": {
"rootDir": ".",
"types": ["node", "jest"]
"types": ["jest"]
}
}
4 changes: 1 addition & 3 deletions packages/tracing/src/hubextensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 7071875

Please sign in to comment.