Skip to content

Commit

Permalink
fix: Use correct types for event context data
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilogorek committed Sep 16, 2020
1 parent daae471 commit 45f14a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions packages/hub/src/scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class Scope implements ScopeInterface {

/** Contexts */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
protected _contexts: { [key: string]: any } = {};
protected _contexts: { [key: string]: Record<any, any> } = {};

/** Fingerprint */
protected _fingerprint?: string[];
Expand Down Expand Up @@ -185,9 +185,14 @@ export class Scope implements ScopeInterface {
/**
* @inheritDoc
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public setContext(key: string, context: { [key: string]: any } | null): this {
this._contexts = { ...this._contexts, [key]: context };
public setContext(key: string, context: { [key: string]: Record<any, any> } | null): this {
if (context === null) {
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete this._contexts[key];
} else {
this._contexts = { ...this._contexts, [key]: context };
}

this._notifyScopeListeners();
return this;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface ScopeContext {
user: User;
level: Severity;
extra: { [key: string]: any };
contexts: { [key: string]: any };
contexts: { [key: string]: Record<any, any> };
tags: { [key: string]: string };
fingerprint: string[];
}
Expand Down

0 comments on commit 45f14a0

Please sign in to comment.