Skip to content

Commit 5fcf461

Browse files
authored
fix: type issue with global amp instance (#18)
1 parent 1ab1565 commit 5fcf461

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

packages/browser/src/integration/amplitude.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ import {
66
import { ExperimentUser } from '../types/user';
77
import { safeGlobal } from '../util/global';
88

9-
declare global {
10-
// eslint-disable-next-line no-var, @typescript-eslint/no-explicit-any
11-
var amplitude: any;
12-
}
13-
149
type AmplitudeIdentify = {
1510
set(property: string, value: unknown): void;
1611
unset(property: string): void;
@@ -101,9 +96,13 @@ export class AmplitudeAnalyticsProvider implements ExperimentAnalyticsProvider {
10196
}
10297

10398
unsetUserProperty(event: ExperimentAnalyticsEvent): void {
99+
const amplitude = safeGlobal['amplitude'];
100+
if (!amplitude) {
101+
return;
102+
}
104103
// if the variant does not have a value, unset the user property
105104
this.amplitudeInstance.identify(
106-
new safeGlobal.amplitude.Identify().unset(event.userProperty),
105+
new amplitude.Identify().unset(event.userProperty),
107106
);
108107
}
109108
}

0 commit comments

Comments
 (0)