fix Typescript errors (#7261)

fix: Typescript errors
This commit is contained in:
Ting-Wai
2025-08-20 11:23:33 -07:00
committed by GitHub
parent c10389c6b1
commit 43465c13be
3 changed files with 8 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
import { Extras } from "@sentry/core";
import { Extras, type Integration, type Event } from "@sentry/core";
import * as Sentry from "@sentry/node";
import os from "node:os";
import { IdeInfo } from "../../index.js";
@@ -25,7 +25,7 @@ export class SentryLogger {
// Filter integrations that use the global variable
const integrations = Sentry.getDefaultIntegrations({}).filter(
(defaultIntegration) => {
(defaultIntegration: Integration) => {
// Remove integrations that might interfere with shared environments
return ![
"OnUncaughtException",
@@ -52,7 +52,7 @@ export class SentryLogger {
sendDefaultPii: false,
// Strip sensitive data and add basic properties before sending events
beforeSend(event) {
beforeSend(event: Event) {
// First apply anonymization
const anonymizedEvent = anonymizeSentryEvent(event);
if (!anonymizedEvent) return null;
@@ -197,7 +197,7 @@ export function createSpan<T>(
}
// Use withScope from Sentry to isolate the span context
return Sentry.withScope((isolatedScope) => {
return Sentry.withScope((isolatedScope: Sentry.Scope) => {
isolatedScope.setClient(client);
return Sentry.startSpan(
{

View File

@@ -1,4 +1,5 @@
import { ErrorEvent } from "@sentry/core";
import * as Sentry from "@sentry/node";
import { type Event } from "@sentry/core";
/**
* Minimalist Sentry anonymization utilities
*/
@@ -75,7 +76,7 @@ export function anonymizeUserInfo(user: any): any {
/**
* Main anonymization function - minimalist approach like Rasa
*/
export function anonymizeSentryEvent(event: ErrorEvent): any | null {
export function anonymizeSentryEvent(event: any): any | null {
try {
// Deep copy to avoid mutating the original event
const anonymized = structuredClone(event);

View File

@@ -59,7 +59,7 @@ const TelemetryProviders = ({ children }: PropsWithChildren) => {
sendDefaultPii: false,
// Strip sensitive data and add basic properties
beforeSend(event) {
beforeSend(event: Sentry.Event) {
// Apply comprehensive anonymization using shared logic
const anonymizedEvent = anonymizeSentryEvent(event);
if (!anonymizedEvent) return null;