Skip to content

Commit 16b235a

Browse files
committed
create hybrid type for domains acting as carriers
1 parent 87be028 commit 16b235a

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

packages/hub/src/hub.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
} from '@sentry/types';
2121
import { consoleSandbox, getGlobalObject, isNodeEnv, logger, timestampWithMs, uuid4 } from '@sentry/utils';
2222

23-
import { Carrier, Layer } from './interfaces';
23+
import { Carrier, DomainAsCarrier, Layer } from './interfaces';
2424
import { Scope } from './scope';
2525

2626
/**
@@ -462,7 +462,7 @@ export function getCurrentHub(): Hub {
462462
*
463463
* @returns The domain, or undefined if there is no active domain
464464
*/
465-
export function getActiveDomain(): any | undefined {
465+
export function getActiveDomain(): DomainAsCarrier | undefined {
466466
const sentry = getMainCarrier().__SENTRY__;
467467

468468
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any

packages/hub/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { Carrier, Layer } from './interfaces';
1+
export { Carrier, DomainAsCarrier, Layer } from './interfaces';
22
export { addGlobalEventProcessor, Scope } from './scope';
33
export {
44
getActiveDomain,

packages/hub/src/interfaces.ts

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

34
import { Hub } from './hub';
45
import { Scope } from './scope';
@@ -26,3 +27,5 @@ export interface Carrier {
2627
extensions?: { [key: string]: Function };
2728
};
2829
}
30+
31+
export interface DomainAsCarrier extends domain.Domain, Carrier {}

0 commit comments

Comments
 (0)