diff --git a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/get/test.ts b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/get/test.ts index bcce3b5c4000..6a5024caee03 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/get/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/get/test.ts @@ -23,7 +23,7 @@ sentryTest('captures Breadcrumb for basic GET request', async ({ getLocalTestUrl expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/getWithRequestObj/test.ts b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/getWithRequestObj/test.ts index c2ba9222a108..fc125817725e 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/getWithRequestObj/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/getWithRequestObj/test.ts @@ -23,7 +23,7 @@ sentryTest('captures Breadcrumb for basic GET request that uses request object', expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/post/test.ts b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/post/test.ts index 317230a631d4..6658c2628f60 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/post/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/post/test.ts @@ -23,7 +23,7 @@ sentryTest('captures Breadcrumb for POST request', async ({ getLocalTestUrl, pag expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/statusCode/test.ts b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/statusCode/test.ts index ba957aec42cc..03b9b636d9e9 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/statusCode/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/statusCode/test.ts @@ -19,7 +19,7 @@ sentryTest('captures Breadcrumb with log level for 4xx response code', async ({ expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', @@ -56,7 +56,7 @@ sentryTest('captures Breadcrumb with log level for 5xx response code', async ({ expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/get/test.ts b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/get/test.ts index 3c3b41e07ea2..02275b0adf2a 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/get/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/get/test.ts @@ -24,7 +24,7 @@ sentryTest('captures Breadcrumb for basic GET request', async ({ getLocalTestUrl expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/post/test.ts b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/post/test.ts index f9c018d2ec70..7de33d189f37 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/post/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/post/test.ts @@ -23,7 +23,7 @@ sentryTest('captures Breadcrumb for POST request', async ({ getLocalTestUrl, pag expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/statusCode/test.ts b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/statusCode/test.ts index 905d00cb85cd..d17613cc1da1 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/statusCode/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/statusCode/test.ts @@ -19,7 +19,7 @@ sentryTest('captures Breadcrumb with log level for 4xx response code', async ({ expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', @@ -56,7 +56,7 @@ sentryTest('captures Breadcrumb with log level for 5xx response code', async ({ expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/fetch/test.ts b/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/fetch/test.ts index 826e6cef48f5..f3fd78bc0b94 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/fetch/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/fetch/test.ts @@ -86,7 +86,7 @@ sentryTest('should update breadcrumbs for GraphQL fetch requests', async ({ getL expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/xhr/test.ts b/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/xhr/test.ts index 5089401441f2..ca9704cc48fe 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/xhr/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/xhr/test.ts @@ -86,7 +86,7 @@ sentryTest('should update breadcrumbs for GraphQL XHR requests', async ({ getLoc expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/integrations/webWorker/test.ts b/dev-packages/browser-integration-tests/suites/integrations/webWorker/test.ts index cc5a8b3c7cf0..bb5adf0ac70a 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/webWorker/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/webWorker/test.ts @@ -4,7 +4,7 @@ import { sentryTest } from '../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../utils/helpers'; sentryTest('Assigns web worker debug IDs when using webWorkerIntegration', async ({ getLocalTestUrl, page }) => { - const bundle = process.env.PW_BUNDLE as string | undefined; + const bundle = process.env.PW_BUNDLE; if (bundle != null && !bundle.includes('esm') && !bundle.includes('cjs')) { sentryTest.skip(); } diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureFeedback/withCaptureException/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureFeedback/withCaptureException/test.ts index faeff404df6b..99023e472526 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureFeedback/withCaptureException/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureFeedback/withCaptureException/test.ts @@ -1,17 +1,17 @@ import { expect } from '@playwright/test'; -import type { Event, FeedbackEvent } from '@sentry/core'; +import type { Event } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers'; sentryTest('capture user feedback when captureException is called', async ({ getLocalTestUrl, page }) => { const url = await getLocalTestUrl({ testDir: __dirname }); - const data = (await getMultipleSentryEnvelopeRequests(page, 2, { url })) as (Event | FeedbackEvent)[]; + const data = await getMultipleSentryEnvelopeRequests(page, 2, { url }); expect(data).toHaveLength(2); - const errorEvent = ('exception' in data[0] ? data[0] : data[1]) as Event; - const feedback = ('exception' in data[0] ? data[1] : data[0]) as FeedbackEvent; + const errorEvent = 'exception' in data[0] ? data[0] : data[1]; + const feedback = 'exception' in data[0] ? data[1] : data[0]; expect(feedback.contexts).toEqual( expect.objectContaining({ diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureFeedback/withCaptureMessage/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureFeedback/withCaptureMessage/test.ts index 4cf2e4165b55..fab1207d9246 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureFeedback/withCaptureMessage/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureFeedback/withCaptureMessage/test.ts @@ -1,17 +1,17 @@ import { expect } from '@playwright/test'; -import type { Event, FeedbackEvent } from '@sentry/core'; +import type { Event } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers'; sentryTest('capture user feedback when captureMessage is called', async ({ getLocalTestUrl, page }) => { const url = await getLocalTestUrl({ testDir: __dirname }); - const data = (await getMultipleSentryEnvelopeRequests(page, 2, { url })) as (Event | FeedbackEvent)[]; + const data = await getMultipleSentryEnvelopeRequests(page, 2, { url }); expect(data).toHaveLength(2); - const errorEvent = ('exception' in data[0] ? data[0] : data[1]) as Event; - const feedback = ('exception' in data[0] ? data[1] : data[0]) as FeedbackEvent; + const errorEvent = 'exception' in data[0] ? data[0] : data[1]; + const feedback = 'exception' in data[0] ? data[1] : data[0]; expect(feedback.contexts).toEqual( expect.objectContaining({ diff --git a/dev-packages/browser-integration-tests/suites/public-api/diagnoseSdkConnectivity/test.ts b/dev-packages/browser-integration-tests/suites/public-api/diagnoseSdkConnectivity/test.ts index 294e60b34bfd..c18d75464223 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/diagnoseSdkConnectivity/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/diagnoseSdkConnectivity/test.ts @@ -3,7 +3,7 @@ import { sentryTest } from '../../../utils/fixtures'; import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../utils/helpers'; sentryTest('makes a call to sentry.io to diagnose SDK connectivity', async ({ getLocalTestUrl, page }) => { - const bundle = process.env.PW_BUNDLE as string | undefined; + const bundle = process.env.PW_BUNDLE; if (shouldSkipTracingTest() || !!bundle) { // the CDN bundle doesn't export diagnoseSdkConnectivity. So skipping the test for bundles. sentryTest.skip(); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/requestAnimationFrame/callback/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/requestAnimationFrame/callback/test.ts index 71f2b8d4ab3b..0d50e0705e1b 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/requestAnimationFrame/callback/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/requestAnimationFrame/callback/test.ts @@ -13,7 +13,7 @@ sentryTest( const outsideCtx = window as any; requestAnimationFrame(function () { // @ts-expect-error re-assigning this - resolve({ outsideCtx, requestAnimationFrameCtx: this as any }); + resolve({ outsideCtx, requestAnimationFrameCtx: this }); }); }); })) as any; diff --git a/dev-packages/browser-integration-tests/suites/replay/dsc/test.ts b/dev-packages/browser-integration-tests/suites/replay/dsc/test.ts index f9a6d1041615..ef0882e0206b 100644 --- a/dev-packages/browser-integration-tests/suites/replay/dsc/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/dsc/test.ts @@ -48,7 +48,7 @@ sentryTest( const req0 = await transactionReq; - const envHeader = envelopeRequestParser(req0, 0) as EventEnvelopeHeaders; + const envHeader = envelopeRequestParser(req0, 0); const replay = await getReplaySnapshot(page); expect(replay.session?.id).toBeDefined(); @@ -96,7 +96,7 @@ sentryTest( const req0 = await transactionReq; - const envHeader = envelopeRequestParser(req0, 0) as EventEnvelopeHeaders; + const envHeader = envelopeRequestParser(req0, 0); const replay = await getReplaySnapshot(page); expect(replay.session?.id).toBeDefined(); @@ -148,7 +148,7 @@ sentryTest( const req0 = await transactionReq; - const envHeader = envelopeRequestParser(req0, 0) as EventEnvelopeHeaders; + const envHeader = envelopeRequestParser(req0, 0); const replay = await getReplaySnapshot(page); expect(replay.session?.id).toBeDefined(); @@ -191,7 +191,7 @@ sentryTest( const req0 = await transactionReq; - const envHeader = envelopeRequestParser(req0, 0) as EventEnvelopeHeaders; + const envHeader = envelopeRequestParser(req0, 0); const replay = await getReplaySnapshot(page); @@ -235,7 +235,7 @@ sentryTest('should add replay_id to error DSC while replay is active', async ({ await page.evaluate('window._triggerError(1)'); - const error1Header = envelopeRequestParser(await error1Req, 0) as EventEnvelopeHeaders; + const error1Header = envelopeRequestParser(await error1Req, 0); const replay = await getReplaySnapshot(page); expect(replay.session?.id).toBeDefined(); @@ -260,7 +260,7 @@ sentryTest('should add replay_id to error DSC while replay is active', async ({ await page.waitForFunction('!window.Replay.getReplayId();'); await page.evaluate('window._triggerError(2)'); - const error2Header = envelopeRequestParser(await error2Req, 0) as EventEnvelopeHeaders; + const error2Header = envelopeRequestParser(await error2Req, 0); expect(error2Header.trace).toBeDefined(); expect(error2Header.trace).toEqual({ diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestBody/test.ts b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestBody/test.ts index e63e2fb285e0..22c756e05bf4 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestBody/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestBody/test.ts @@ -44,7 +44,7 @@ sentryTest('captures text request body', async ({ getLocalTestUrl, page, browser expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', @@ -114,7 +114,7 @@ sentryTest('captures JSON request body', async ({ getLocalTestUrl, page, browser expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', @@ -188,7 +188,7 @@ sentryTest('captures non-text request body', async ({ getLocalTestUrl, page, bro expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', @@ -258,7 +258,7 @@ sentryTest('captures text request body when matching relative URL', async ({ get expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', @@ -326,7 +326,7 @@ sentryTest('does not capture request body when URL does not match', async ({ get expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestHeaders/test.ts b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestHeaders/test.ts index 01afceca077c..bdb2c6d05110 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestHeaders/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestHeaders/test.ts @@ -46,7 +46,7 @@ sentryTest('handles empty/missing request headers', async ({ getLocalTestUrl, pa expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', @@ -118,7 +118,7 @@ sentryTest('captures request headers as POJO', async ({ getLocalTestUrl, page, b expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', @@ -198,7 +198,7 @@ sentryTest('captures request headers on Request', async ({ getLocalTestUrl, page expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', @@ -277,7 +277,7 @@ sentryTest('captures request headers as Headers instance', async ({ getLocalTest expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', @@ -353,7 +353,7 @@ sentryTest('does not captures request headers if URL does not match', async ({ g expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestSize/test.ts b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestSize/test.ts index 5671bdaabc1a..2790f26ac476 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestSize/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestSize/test.ts @@ -45,7 +45,7 @@ sentryTest('captures request body size when body is sent', async ({ getLocalTest expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', @@ -124,7 +124,7 @@ sentryTest('captures request size from non-text request body', async ({ getLocal expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseBody/test.ts b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseBody/test.ts index 4f5926f742ef..a64f1667ec95 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseBody/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseBody/test.ts @@ -44,7 +44,7 @@ sentryTest('captures text response body', async ({ getLocalTestUrl, page, browse expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', @@ -116,7 +116,7 @@ sentryTest('captures JSON response body', async ({ getLocalTestUrl, page, browse expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', @@ -188,7 +188,7 @@ sentryTest('captures non-text response body', async ({ getLocalTestUrl, page, br expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', @@ -260,7 +260,7 @@ sentryTest.skip('does not capture response body when URL does not match', async expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseHeaders/test.ts b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseHeaders/test.ts index 86913966aaa1..74f677280657 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseHeaders/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseHeaders/test.ts @@ -43,7 +43,7 @@ sentryTest('handles empty headers', async ({ getLocalTestUrl, page, browserName expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', @@ -111,7 +111,7 @@ sentryTest('captures response headers', async ({ getLocalTestUrl, page }) => { expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', @@ -185,7 +185,7 @@ sentryTest('does not capture response headers if URL does not match', async ({ g expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseSize/test.ts b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseSize/test.ts index 58375d604dd2..65fcd44d74ad 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseSize/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseSize/test.ts @@ -49,7 +49,7 @@ sentryTest('captures response size from Content-Length header if available', asy expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', @@ -131,7 +131,7 @@ sentryTest('captures response size without Content-Length header', async ({ getL expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', @@ -213,7 +213,7 @@ sentryTest('captures response size from non-text response body', async ({ getLoc expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'fetch', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureTimestamps/test.ts b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureTimestamps/test.ts index df63c10084b4..715fddecfd34 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureTimestamps/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureTimestamps/test.ts @@ -61,5 +61,5 @@ sentryTest('captures correct timestamps', async ({ getLocalTestUrl, page, browse expect(endTimestamp).toEqual(expect.any(Number)); expect(endTimestamp).toBeGreaterThan(startTimestamp); - expect(eventData!.breadcrumbs![0].timestamp).toBeGreaterThan(startTimestamp); + expect(eventData.breadcrumbs![0].timestamp).toBeGreaterThan(startTimestamp); }); diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestBody/test.ts b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestBody/test.ts index 6b0e6e88f3e1..90e6ae4ec154 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestBody/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestBody/test.ts @@ -47,7 +47,7 @@ sentryTest('captures text request body', async ({ getLocalTestUrl, page, browser expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', @@ -119,7 +119,7 @@ sentryTest('captures JSON request body', async ({ getLocalTestUrl, page, browser expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', @@ -195,7 +195,7 @@ sentryTest('captures non-text request body', async ({ getLocalTestUrl, page, bro expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', @@ -267,7 +267,7 @@ sentryTest('captures text request body when matching relative URL', async ({ get expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', @@ -339,7 +339,7 @@ sentryTest('does not capture request body when URL does not match', async ({ get expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestHeaders/test.ts b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestHeaders/test.ts index 12f3a59f5fb1..2f40dc9bb469 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestHeaders/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestHeaders/test.ts @@ -51,7 +51,7 @@ sentryTest('captures request headers', async ({ getLocalTestUrl, page, browserNa expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', @@ -129,7 +129,7 @@ sentryTest('does not capture request headers if URL does not match', async ({ ge expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestSize/test.ts b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestSize/test.ts index 2fe599bbe831..48f2f30ebb79 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestSize/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestSize/test.ts @@ -49,7 +49,7 @@ sentryTest('captures request body size when body is sent', async ({ getLocalTest expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', @@ -131,7 +131,7 @@ sentryTest('captures request size from non-text request body', async ({ getLocal expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseBody/test.ts b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseBody/test.ts index 4764d32b16df..f74842f38883 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseBody/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseBody/test.ts @@ -51,7 +51,7 @@ sentryTest('captures text response body', async ({ getLocalTestUrl, page, browse expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', @@ -127,7 +127,7 @@ sentryTest('captures JSON response body', async ({ getLocalTestUrl, page, browse expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', @@ -205,7 +205,7 @@ sentryTest('captures JSON response body when responseType=json', async ({ getLoc expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', @@ -281,7 +281,7 @@ sentryTest('captures non-text response body', async ({ getLocalTestUrl, page, br expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', @@ -357,7 +357,7 @@ sentryTest('does not capture response body when URL does not match', async ({ ge expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseHeaders/test.ts b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseHeaders/test.ts index f4b444455b46..d728c6995592 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseHeaders/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseHeaders/test.ts @@ -54,7 +54,7 @@ sentryTest('captures response headers', async ({ getLocalTestUrl, page, browserN expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', @@ -136,7 +136,7 @@ sentryTest( expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseSize/test.ts b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseSize/test.ts index 5f14ac8b17cd..a3c3ba9746fe 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseSize/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseSize/test.ts @@ -52,7 +52,7 @@ sentryTest( expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', @@ -223,7 +223,7 @@ sentryTest('captures response size for non-string bodies', async ({ getLocalTest expect(eventData.exception?.values).toHaveLength(1); expect(eventData?.breadcrumbs?.length).toBe(1); - expect(eventData!.breadcrumbs![0]).toEqual({ + expect(eventData.breadcrumbs![0]).toEqual({ timestamp: expect.any(Number), category: 'xhr', type: 'http', diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureTimestamps/test.ts b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureTimestamps/test.ts index ef4b9aee3c26..40c9462fff21 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureTimestamps/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureTimestamps/test.ts @@ -68,5 +68,5 @@ sentryTest('captures correct timestamps', async ({ getLocalTestUrl, page, browse expect(endTimestamp).toEqual(expect.any(Number)); expect(endTimestamp).toBeGreaterThan(startTimestamp); - expect(eventData!.breadcrumbs![0].timestamp).toBeGreaterThan(startTimestamp); + expect(eventData.breadcrumbs![0].timestamp).toBeGreaterThan(startTimestamp); }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/element-timing/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/element-timing/test.ts index e17cbbbda691..d5dabb5d0ca5 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/element-timing/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/element-timing/test.ts @@ -28,7 +28,7 @@ sentryTest( const imageFastSpan = elementTimingSpans?.find(({ description }) => description === 'element[image-fast]'); const imageFastRenderTime = imageFastSpan?.data['element.render_time']; const imageFastLoadTime = imageFastSpan?.data['element.load_time']; - const duration = imageFastSpan!.timestamp! - imageFastSpan!.start_timestamp!; + const duration = imageFastSpan!.timestamp! - imageFastSpan!.start_timestamp; expect(imageFastSpan).toBeDefined(); expect(imageFastSpan?.data).toEqual({ @@ -58,7 +58,7 @@ sentryTest( const text1Span = elementTimingSpans?.find(({ data }) => data?.['element.identifier'] === 'text1'); const text1RenderTime = text1Span?.data['element.render_time']; const text1LoadTime = text1Span?.data['element.load_time']; - const text1Duration = text1Span!.timestamp! - text1Span!.start_timestamp!; + const text1Duration = text1Span!.timestamp! - text1Span!.start_timestamp; expect(text1Span).toBeDefined(); expect(text1Span?.data).toEqual({ 'sentry.op': 'ui.elementtiming', @@ -109,7 +109,7 @@ sentryTest( }); const imageSlowRenderTime = imageSlowSpan?.data['element.render_time']; const imageSlowLoadTime = imageSlowSpan?.data['element.load_time']; - const imageSlowDuration = imageSlowSpan!.timestamp! - imageSlowSpan!.start_timestamp!; + const imageSlowDuration = imageSlowSpan!.timestamp! - imageSlowSpan!.start_timestamp; expect(imageSlowRenderTime).toBeGreaterThan(1400); expect(imageSlowRenderTime).toBeLessThan(2000); expect(imageSlowLoadTime).toBeGreaterThan(1400); @@ -137,7 +137,7 @@ sentryTest( }); const lazyImageRenderTime = lazyImageSpan?.data['element.render_time']; const lazyImageLoadTime = lazyImageSpan?.data['element.load_time']; - const lazyImageDuration = lazyImageSpan!.timestamp! - lazyImageSpan!.start_timestamp!; + const lazyImageDuration = lazyImageSpan!.timestamp! - lazyImageSpan!.start_timestamp; expect(lazyImageRenderTime).toBeGreaterThan(1000); expect(lazyImageRenderTime).toBeLessThan(1500); expect(lazyImageLoadTime).toBeGreaterThan(1000); @@ -155,7 +155,7 @@ sentryTest( }); const lazyTextRenderTime = lazyTextSpan?.data['element.render_time']; const lazyTextLoadTime = lazyTextSpan?.data['element.load_time']; - const lazyTextDuration = lazyTextSpan!.timestamp! - lazyTextSpan!.start_timestamp!; + const lazyTextDuration = lazyTextSpan!.timestamp! - lazyTextSpan!.start_timestamp; expect(lazyTextRenderTime).toBeGreaterThan(1000); expect(lazyTextRenderTime).toBeLessThan(1500); expect(lazyTextLoadTime).toBe(0); diff --git a/dev-packages/browser-integration-tests/suites/transport/offline/queued/test.ts b/dev-packages/browser-integration-tests/suites/transport/offline/queued/test.ts index 13694a383c54..5df36411011c 100644 --- a/dev-packages/browser-integration-tests/suites/transport/offline/queued/test.ts +++ b/dev-packages/browser-integration-tests/suites/transport/offline/queued/test.ts @@ -37,7 +37,7 @@ sentryTest('should queue and retry events when they fail to send', async ({ getL const eventData = await getMultipleSentryEnvelopeRequests(page, 3, { url, timeout: 10_000 }); // Filter out any client reports - const events = eventData.filter(e => !('discarded_events' in e)) as Event[]; + const events = eventData.filter(e => !('discarded_events' in e)); expect(events).toHaveLength(2); diff --git a/dev-packages/browser-integration-tests/utils/helpers.ts b/dev-packages/browser-integration-tests/utils/helpers.ts index b3f55b4550a0..dd75d2f6ee86 100644 --- a/dev-packages/browser-integration-tests/utils/helpers.ts +++ b/dev-packages/browser-integration-tests/utils/helpers.ts @@ -310,7 +310,7 @@ export async function waitForSession(page: Page): Promise { * @returns `true` if we should skip the tracing test */ export function shouldSkipTracingTest(): boolean { - const bundle = process.env.PW_BUNDLE as string | undefined; + const bundle = process.env.PW_BUNDLE; return bundle != null && !bundle.includes('tracing') && !bundle.includes('esm') && !bundle.includes('cjs'); } @@ -330,7 +330,7 @@ export function shouldSkipFeedbackTest(): boolean { * @returns `true` if we should skip the feature flags test */ export function shouldSkipFeatureFlagsTest(): boolean { - const bundle = process.env.PW_BUNDLE as string | undefined; + const bundle = process.env.PW_BUNDLE; return bundle != null && !bundle.includes('esm') && !bundle.includes('cjs'); } @@ -423,7 +423,7 @@ export async function getMultipleSentryEnvelopeRequests( }, requestParser: (req: Request) => T = envelopeRequestParser as (req: Request) => T, ): Promise { - return getMultipleRequests(page, count, envelopeUrlRegex, requestParser, options) as Promise; + return getMultipleRequests(page, count, envelopeUrlRegex, requestParser, options); } /** diff --git a/dev-packages/browser-integration-tests/utils/replayHelpers.ts b/dev-packages/browser-integration-tests/utils/replayHelpers.ts index f1f18967e69b..86a9e5ba3d78 100644 --- a/dev-packages/browser-integration-tests/utils/replayHelpers.ts +++ b/dev-packages/browser-integration-tests/utils/replayHelpers.ts @@ -431,7 +431,7 @@ export const replayEnvelopeParser = (request: Request | null): unknown[] => { * @returns `true` if we should skip the replay test */ export function shouldSkipReplayTest(): boolean { - const bundle = process.env.PW_BUNDLE as string | undefined; + const bundle = process.env.PW_BUNDLE; return bundle != null && !bundle.includes('replay') && !bundle.includes('esm') && !bundle.includes('cjs'); } diff --git a/dev-packages/browser-integration-tests/utils/wasmHelpers.ts b/dev-packages/browser-integration-tests/utils/wasmHelpers.ts index cb8cf1bcb4b3..5287f5db0436 100644 --- a/dev-packages/browser-integration-tests/utils/wasmHelpers.ts +++ b/dev-packages/browser-integration-tests/utils/wasmHelpers.ts @@ -10,6 +10,6 @@ export function shouldSkipWASMTests(browser: string): boolean { if (browser === 'webkit') { return true; } - const bundle = process.env.PW_BUNDLE as string | undefined; + const bundle = process.env.PW_BUNDLE; return bundle != null; } diff --git a/dev-packages/node-core-integration-tests/utils/runner.ts b/dev-packages/node-core-integration-tests/utils/runner.ts index 273680607ffb..da6184dcbb42 100644 --- a/dev-packages/node-core-integration-tests/utils/runner.ts +++ b/dev-packages/node-core-integration-tests/utils/runner.ts @@ -427,7 +427,7 @@ export function createRunner(...paths: string[]) { ? runDockerCompose(dockerOptions) : Promise.resolve(undefined); - const startup = Promise.all([dockerStartup, serverStartup]) as Promise<[DockerStartup, ServerStartup]>; + const startup = Promise.all([dockerStartup, serverStartup]); startup .then(([dockerChild, [mockServerPort, mockServerClose]]) => { diff --git a/dev-packages/node-integration-tests/suites/express/multiple-init/server.ts b/dev-packages/node-integration-tests/suites/express/multiple-init/server.ts index f9952ce43a9f..0f5bf73d7e5b 100644 --- a/dev-packages/node-integration-tests/suites/express/multiple-init/server.ts +++ b/dev-packages/node-integration-tests/suites/express/multiple-init/server.ts @@ -36,7 +36,7 @@ app.get('/test/init', (_req, res) => { transport: loggingTransport, }); // Set this on initial scope, to ensure it can be inherited - initialCurrentScope.setClient(Sentry.getClient()!); + initialCurrentScope.setClient(Sentry.getClient()); Sentry.addBreadcrumb({ message: 'init breadcrumb' }); Sentry.setTag('init', 'tag'); diff --git a/dev-packages/node-integration-tests/utils/runner.ts b/dev-packages/node-integration-tests/utils/runner.ts index dfe27dc5a4a5..fe6d9a8f8c45 100644 --- a/dev-packages/node-integration-tests/utils/runner.ts +++ b/dev-packages/node-integration-tests/utils/runner.ts @@ -538,7 +538,7 @@ export function createRunner(...paths: string[]) { ? runDockerCompose(dockerOptions) : Promise.resolve(undefined); - const startup = Promise.all([dockerStartup, serverStartup]) as Promise<[DockerStartup, ServerStartup]>; + const startup = Promise.all([dockerStartup, serverStartup]); startup .then(([dockerChild, [mockServerPort, mockServerClose]]) => { diff --git a/packages/astro/test/server/middleware.test.ts b/packages/astro/test/server/middleware.test.ts index 10e314268264..020365dda627 100644 --- a/packages/astro/test/server/middleware.test.ts +++ b/packages/astro/test/server/middleware.test.ts @@ -200,9 +200,9 @@ describe('sentryMiddleware', () => { // @ts-expect-error, a partial ctx object is fine here const resultFromNext = await middleware(ctx, next); + expect(resultFromNext).toBeDefined(); expect(resultFromNext?.headers.get('content-type')).toEqual('text/html'); - - await expect(() => resultFromNext!.text()).rejects.toThrowError(); + await expect(() => resultFromNext?.text()).rejects.toThrowError(); expect(captureExceptionSpy).toHaveBeenCalledWith(error, { mechanism: { handled: false, type: 'auto.middleware.astro' }, diff --git a/packages/aws-serverless/test/sdk.test.ts b/packages/aws-serverless/test/sdk.test.ts index d2047274d744..a3aef6a10b5d 100644 --- a/packages/aws-serverless/test/sdk.test.ts +++ b/packages/aws-serverless/test/sdk.test.ts @@ -19,7 +19,7 @@ const mockScope = { vi.mock('@sentry/node', async () => { // eslint-disable-next-line @typescript-eslint/consistent-type-imports - const original = (await vi.importActual('@sentry/node')) as typeof import('@sentry/node'); + const original = await vi.importActual('@sentry/node'); return { ...original, initWithoutDefaultIntegrations: (options: unknown) => { @@ -459,7 +459,7 @@ describe('AWSLambda', () => { const streamError = new Error('stream error'); const streamingHandler = vi.fn(async (_event, responseStream, _context) => { // Simulate stream error by calling the error listener - const errorListener = (responseStream.on as any).mock.calls.find((call: any[]) => call[0] === 'error')?.[1]; + const errorListener = responseStream.on.mock.calls.find((call: any[]) => call[0] === 'error')?.[1]; if (errorListener) { errorListener(streamError); } diff --git a/packages/aws-serverless/test/utils.test.ts b/packages/aws-serverless/test/utils.test.ts index 8fba98d0add6..2f3516ce8e35 100644 --- a/packages/aws-serverless/test/utils.test.ts +++ b/packages/aws-serverless/test/utils.test.ts @@ -4,7 +4,7 @@ import { eventContextExtractor, getAwsTraceData } from '../src/utils'; const mockExtractContext = vi.fn(); vi.mock('@opentelemetry/api', async () => { // eslint-disable-next-line @typescript-eslint/consistent-type-imports - const actualApi = (await vi.importActual('@opentelemetry/api')) as typeof import('@opentelemetry/api'); + const actualApi = await vi.importActual('@opentelemetry/api'); return { ...actualApi, propagation: { diff --git a/packages/browser-utils/src/metrics/browserMetrics.ts b/packages/browser-utils/src/metrics/browserMetrics.ts index 8b1592408e8a..2c61408c1d76 100644 --- a/packages/browser-utils/src/metrics/browserMetrics.ts +++ b/packages/browser-utils/src/metrics/browserMetrics.ts @@ -473,8 +473,8 @@ export function _addMeasureSpans( // Measurements from third parties can be off, which would create invalid spans, dropping transactions in the process. if (measureStartTimestamp <= measureEndTimestamp) { startAndEndSpan(span, measureStartTimestamp, measureEndTimestamp, { - name: entry.name as string, - op: entry.entryType as string, + name: entry.name, + op: entry.entryType, attributes, }); } @@ -595,9 +595,9 @@ function _getEndPropertyNameForNavigationTiming(event: StartEventName): EndEvent /** Create request and response related spans */ function _addRequest(span: Span, entry: PerformanceNavigationTiming, timeOrigin: number): void { - const requestStartTimestamp = timeOrigin + msToSec(entry.requestStart as number); - const responseEndTimestamp = timeOrigin + msToSec(entry.responseEnd as number); - const responseStartTimestamp = timeOrigin + msToSec(entry.responseStart as number); + const requestStartTimestamp = timeOrigin + msToSec(entry.requestStart); + const responseEndTimestamp = timeOrigin + msToSec(entry.responseEnd); + const responseStartTimestamp = timeOrigin + msToSec(entry.responseStart); if (entry.responseEnd) { // It is possible that we are collecting these metrics when the page hasn't finished loading yet, for example when the HTML slowly streams in. // In this case, ie. when the document request hasn't finished yet, `entry.responseEnd` will be 0. diff --git a/packages/browser-utils/src/metrics/web-vitals/getCLS.ts b/packages/browser-utils/src/metrics/web-vitals/getCLS.ts index 1b4d50a7c44e..c40f993f8ca8 100644 --- a/packages/browser-utils/src/metrics/web-vitals/getCLS.ts +++ b/packages/browser-utils/src/metrics/web-vitals/getCLS.ts @@ -74,7 +74,7 @@ export const onCLS = (onReport: (metric: CLSMetric) => void, opts: ReportOpts = const po = observe('layout-shift', handleEntries); if (po) { - report = bindReporter(onReport, metric, CLSThresholds, opts!.reportAllChanges); + report = bindReporter(onReport, metric, CLSThresholds, opts.reportAllChanges); WINDOW.document?.addEventListener('visibilitychange', () => { if (WINDOW.document?.visibilityState === 'hidden') { diff --git a/packages/browser-utils/src/metrics/web-vitals/getLCP.ts b/packages/browser-utils/src/metrics/web-vitals/getLCP.ts index 0f2f821d9bcc..6eafee698673 100644 --- a/packages/browser-utils/src/metrics/web-vitals/getLCP.ts +++ b/packages/browser-utils/src/metrics/web-vitals/getLCP.ts @@ -52,7 +52,7 @@ export const onLCP = (onReport: (metric: LCPMetric) => void, opts: ReportOpts = const handleEntries = (entries: LCPMetric['entries']) => { // If reportAllChanges is set then call this function for each entry, // otherwise only consider the last one. - if (!opts!.reportAllChanges) { + if (!opts.reportAllChanges) { // eslint-disable-next-line no-param-reassign entries = entries.slice(-1); } diff --git a/packages/browser-utils/src/metrics/web-vitals/lib/InteractionManager.ts b/packages/browser-utils/src/metrics/web-vitals/lib/InteractionManager.ts index 033cdb2cb836..d4aea1683606 100644 --- a/packages/browser-utils/src/metrics/web-vitals/lib/InteractionManager.ts +++ b/packages/browser-utils/src/metrics/web-vitals/lib/InteractionManager.ts @@ -104,7 +104,7 @@ export class InteractionManager { // The least-long of the 10 longest interactions. const minLongestInteraction = this._longestInteractionList.at(-1); - let interaction = this._longestInteractionMap.get(entry.interactionId!); + let interaction = this._longestInteractionMap.get(entry.interactionId); // Only process the entry if it's possibly one of the ten longest, // or if it's part of an existing interaction. @@ -126,7 +126,7 @@ export class InteractionManager { } } else { interaction = { - id: entry.interactionId!, + id: entry.interactionId, entries: [entry], _latency: entry.duration, }; diff --git a/packages/browser/src/eventbuilder.ts b/packages/browser/src/eventbuilder.ts index 67cb4d2578cd..cc0be3378b8d 100644 --- a/packages/browser/src/eventbuilder.ts +++ b/packages/browser/src/eventbuilder.ts @@ -309,7 +309,7 @@ export function eventFromUnknownInput( // If it's a plain object or an instance of `Event` (the built-in JS kind, not this SDK's `Event` type), serialize // it manually. This will allow us to group events based on top-level keys which is much better than creating a new // group on any key/value change. - const objectException = exception as Record; + const objectException = exception; event = eventFromPlainObject(stackParser, objectException, syntheticException, isUnhandledRejection); addExceptionMechanism(event, { synthetic: true, diff --git a/packages/browser/src/integrations/globalhandlers.ts b/packages/browser/src/integrations/globalhandlers.ts index 2aa29731a9b0..fa815db7c15e 100644 --- a/packages/browser/src/integrations/globalhandlers.ts +++ b/packages/browser/src/integrations/globalhandlers.ts @@ -86,7 +86,7 @@ function _installGlobalOnUnhandledRejectionHandler(client: Client): void { return; } - const error = _getUnhandledRejectionError(e as unknown); + const error = _getUnhandledRejectionError(e); const event = isPrimitive(error) ? _eventFromRejectionWithPrimitive(error) diff --git a/packages/browser/test/integrations/webWorker.test.ts b/packages/browser/test/integrations/webWorker.test.ts index eacd2b53344d..4dfea4983949 100644 --- a/packages/browser/test/integrations/webWorker.test.ts +++ b/packages/browser/test/integrations/webWorker.test.ts @@ -117,7 +117,7 @@ describe('webWorkerIntegration', () => { // Extract the message handler from the addEventListener call expect(mockWorker.addEventListener.mock.calls).toBeDefined(); - messageHandler = mockWorker.addEventListener.mock.calls![0]![1]; + messageHandler = mockWorker.addEventListener.mock.calls[0]![1]; }); it('ignores non-Sentry messages', () => { diff --git a/packages/browser/test/tracing/browserTracingIntegration.test.ts b/packages/browser/test/tracing/browserTracingIntegration.test.ts index 7e573cae1866..e3f1060655c2 100644 --- a/packages/browser/test/tracing/browserTracingIntegration.test.ts +++ b/packages/browser/test/tracing/browserTracingIntegration.test.ts @@ -873,7 +873,7 @@ describe('browserTracingIntegration', () => { const idleSpan = getActiveSpan()!; expect(idleSpan).toBeDefined(); - const dynamicSamplingContext = getDynamicSamplingContextFromSpan(idleSpan!); + const dynamicSamplingContext = getDynamicSamplingContextFromSpan(idleSpan); const propagationContext = getCurrentScope().getPropagationContext(); // Span is correct @@ -1010,7 +1010,7 @@ describe('browserTracingIntegration', () => { const idleSpan = getActiveSpan()!; expect(idleSpan).toBeDefined(); - const dynamicSamplingContext = getDynamicSamplingContextFromSpan(idleSpan!); + const dynamicSamplingContext = getDynamicSamplingContextFromSpan(idleSpan); const propagationContext = getCurrentScope().getPropagationContext(); // Span is correct diff --git a/packages/cloudflare/src/workflows.ts b/packages/cloudflare/src/workflows.ts index 336df2abe301..16327ea71ccf 100644 --- a/packages/cloudflare/src/workflows.ts +++ b/packages/cloudflare/src/workflows.ts @@ -192,5 +192,5 @@ export function instrumentWorkflowWithSentry< }, }); }, - }) as C; + }); } diff --git a/packages/cloudflare/test/durableobject.test.ts b/packages/cloudflare/test/durableobject.test.ts index ce794dc7fb69..4d9e2a20fe97 100644 --- a/packages/cloudflare/test/durableobject.test.ts +++ b/packages/cloudflare/test/durableobject.test.ts @@ -23,10 +23,7 @@ describe('instrumentDurableObjectWithSentry', () => { return 'sync-result'; } }; - const obj = Reflect.construct( - instrumentDurableObjectWithSentry(vi.fn().mockReturnValue({}), testClass as any), - [], - ) as any; + const obj = Reflect.construct(instrumentDurableObjectWithSentry(vi.fn().mockReturnValue({}), testClass as any), []); expect(obj.method).toBe(obj.method); const result = obj.method(); @@ -40,10 +37,7 @@ describe('instrumentDurableObjectWithSentry', () => { return 'async-result'; } }; - const obj = Reflect.construct( - instrumentDurableObjectWithSentry(vi.fn().mockReturnValue({}), testClass as any), - [], - ) as any; + const obj = Reflect.construct(instrumentDurableObjectWithSentry(vi.fn().mockReturnValue({}), testClass as any), []); expect(obj.asyncMethod).toBe(obj.asyncMethod); const result = obj.asyncMethod(); @@ -74,13 +68,13 @@ describe('instrumentDurableObjectWithSentry', () => { const instance1 = Reflect.construct(instrumentDurableObjectWithSentry(options, testClass as any), [ mockContext, mockEnv, - ]) as any; + ]); instance1.method(); const instance2 = Reflect.construct(instrumentDurableObjectWithSentry(options, testClass as any), [ mockContext, mockEnv, - ]) as any; + ]); instance2.method(); expect(initCore).nthCalledWith(1, expect.any(Function), expect.objectContaining({ orgId: 1 })); @@ -156,7 +150,7 @@ describe('instrumentDurableObjectWithSentry', () => { }; const options = vi.fn().mockReturnValue({}); const instrumented = instrumentDurableObjectWithSentry(options, testClass as any); - const obj = Reflect.construct(instrumented, []) as any; + const obj = Reflect.construct(instrumented, []); expect(isInstrumented(obj.prototypeMethod)).toBeFalsy(); }); @@ -169,7 +163,7 @@ describe('instrumentDurableObjectWithSentry', () => { }; const options = vi.fn().mockReturnValue({ instrumentPrototypeMethods: false }); const instrumented = instrumentDurableObjectWithSentry(options, testClass as any); - const obj = Reflect.construct(instrumented, []) as any; + const obj = Reflect.construct(instrumented, []); expect(isInstrumented(obj.prototypeMethod)).toBeFalsy(); }); @@ -185,7 +179,7 @@ describe('instrumentDurableObjectWithSentry', () => { }; const options = vi.fn().mockReturnValue({ instrumentPrototypeMethods: true }); const instrumented = instrumentDurableObjectWithSentry(options, testClass as any); - const obj = Reflect.construct(instrumented, []) as any; + const obj = Reflect.construct(instrumented, []); expect(isInstrumented(obj.methodOne)).toBeTruthy(); expect(isInstrumented(obj.methodTwo)).toBeTruthy(); @@ -205,7 +199,7 @@ describe('instrumentDurableObjectWithSentry', () => { }; const options = vi.fn().mockReturnValue({ instrumentPrototypeMethods: ['methodOne', 'methodThree'] }); const instrumented = instrumentDurableObjectWithSentry(options, testClass as any); - const obj = Reflect.construct(instrumented, []) as any; + const obj = Reflect.construct(instrumented, []); expect(isInstrumented(obj.methodOne)).toBeTruthy(); expect(isInstrumented(obj.methodTwo)).toBeFalsy(); @@ -224,7 +218,7 @@ describe('instrumentDurableObjectWithSentry', () => { }; const options = vi.fn().mockReturnValue({ instrumentPrototypeMethods: false }); const instrumented = instrumentDurableObjectWithSentry(options, testClass as any); - const obj = Reflect.construct(instrumented, []) as any; + const obj = Reflect.construct(instrumented, []); // Instance methods should still be instrumented expect(isInstrumented(obj.propertyFunction)).toBeTruthy(); diff --git a/packages/cloudflare/test/integrations/fetch.test.ts b/packages/cloudflare/test/integrations/fetch.test.ts index 03cdbb9bf5a5..11dbaa18916b 100644 --- a/packages/cloudflare/test/integrations/fetch.test.ts +++ b/packages/cloudflare/test/integrations/fetch.test.ts @@ -7,7 +7,7 @@ import { fetchIntegration } from '../../src/integrations/fetch'; class FakeClient extends CloudflareClient { public getIntegrationByName(name: string): T | undefined { - return name === 'Fetch' ? (fetchIntegration() as Integration as T) : undefined; + return name === 'Fetch' ? (fetchIntegration() as T) : undefined; } } diff --git a/packages/cloudflare/test/workflow.test.ts b/packages/cloudflare/test/workflow.test.ts index 2ca2ccd28e46..fa922d7233e0 100644 --- a/packages/cloudflare/test/workflow.test.ts +++ b/packages/cloudflare/test/workflow.test.ts @@ -449,7 +449,7 @@ describe.skipIf(NODE_MAJOR_VERSION < 20)('workflows', () => { expect(mockContext.waitUntil).toHaveBeenCalledTimes(2); expect(mockTransport.send).toHaveBeenCalledTimes(1); - const sendArg = mockTransport.send.mock.calls[0]![0] as any; + const sendArg = mockTransport.send.mock.calls[0]![0]; const items = sendArg[1] as any[]; const rootSpanItem = items.find(i => i[0].type === 'transaction'); expect(rootSpanItem).toBeDefined(); diff --git a/packages/core/src/asyncContext/stackStrategy.ts b/packages/core/src/asyncContext/stackStrategy.ts index 845605be731d..87dc534fc636 100644 --- a/packages/core/src/asyncContext/stackStrategy.ts +++ b/packages/core/src/asyncContext/stackStrategy.ts @@ -135,7 +135,7 @@ function withScope(callback: (scope: Scope) => T): T { } function withSetScope(scope: Scope, callback: (scope: Scope) => T): T { - const stack = getAsyncContextStack() as AsyncContextStack; + const stack = getAsyncContextStack(); return stack.withScope(() => { stack.getStackTop().scope = scope; return callback(scope); diff --git a/packages/core/src/breadcrumbs.ts b/packages/core/src/breadcrumbs.ts index 99deafdd8d2d..d6e15fcd0b02 100644 --- a/packages/core/src/breadcrumbs.ts +++ b/packages/core/src/breadcrumbs.ts @@ -28,7 +28,7 @@ export function addBreadcrumb(breadcrumb: Breadcrumb, hint?: BreadcrumbHint): vo const timestamp = dateTimestampInSeconds(); const mergedBreadcrumb = { timestamp, ...breadcrumb }; const finalBreadcrumb = beforeBreadcrumb - ? (consoleSandbox(() => beforeBreadcrumb(mergedBreadcrumb, hint)) as Breadcrumb | null) + ? consoleSandbox(() => beforeBreadcrumb(mergedBreadcrumb, hint)) : mergedBreadcrumb; if (finalBreadcrumb === null) return; diff --git a/packages/core/src/fetch.ts b/packages/core/src/fetch.ts index 501c29b4ea10..9ab62ec732da 100644 --- a/packages/core/src/fetch.ts +++ b/packages/core/src/fetch.ts @@ -248,7 +248,7 @@ export function _addTracingHeadersToFetchRequest( baggage: string | undefined; traceparent?: string; } = { - ...(originalHeaders as Exclude), + ...originalHeaders, 'sentry-trace': (existingSentryTraceHeader as string | undefined) ?? sentryTrace, baggage: newBaggageHeaders.length > 0 ? newBaggageHeaders.join(',') : undefined, }; diff --git a/packages/core/src/integrations/mcp-server/index.ts b/packages/core/src/integrations/mcp-server/index.ts index 1e16eaf202f3..a1eb8815805a 100644 --- a/packages/core/src/integrations/mcp-server/index.ts +++ b/packages/core/src/integrations/mcp-server/index.ts @@ -64,5 +64,5 @@ export function wrapMcpServerWithSentry(mcpServerInstance: S): wrapAllMCPHandlers(serverInstance); wrappedMcpServerInstances.add(mcpServerInstance); - return mcpServerInstance as S; + return mcpServerInstance; } diff --git a/packages/core/src/integrations/mcp-server/methodConfig.ts b/packages/core/src/integrations/mcp-server/methodConfig.ts index a652cd8cc41a..b57c0f254b63 100644 --- a/packages/core/src/integrations/mcp-server/methodConfig.ts +++ b/packages/core/src/integrations/mcp-server/methodConfig.ts @@ -56,7 +56,7 @@ export function extractTargetInfo( target?: string; attributes: Record; } { - const config = METHOD_CONFIGS[method as keyof typeof METHOD_CONFIGS]; + const config = METHOD_CONFIGS[method]; if (!config) { return { attributes: {} }; } @@ -80,7 +80,7 @@ export function extractTargetInfo( */ export function getRequestArguments(method: string, params: Record): Record { const args: Record = {}; - const config = METHOD_CONFIGS[method as keyof typeof METHOD_CONFIGS]; + const config = METHOD_CONFIGS[method]; if (!config) { return args; diff --git a/packages/core/src/integrations/mcp-server/spans.ts b/packages/core/src/integrations/mcp-server/spans.ts index 9a527046b6f2..fdd4c107ee30 100644 --- a/packages/core/src/integrations/mcp-server/spans.ts +++ b/packages/core/src/integrations/mcp-server/spans.ts @@ -78,7 +78,7 @@ function buildSentryAttributes(type: McpSpanConfig['type']): Record | undefined; + const params = message.params; // Determine span name based on type and OTEL conventions let spanName: string; @@ -172,7 +172,7 @@ export function buildMcpServerSpanConfig( attributes: Record; } { const { method } = jsonRpcMessage; - const params = jsonRpcMessage.params as Record | undefined; + const params = jsonRpcMessage.params; const targetInfo = extractTargetInfo(method, params || {}); const spanName = createSpanName(method, targetInfo.target); diff --git a/packages/core/src/integrations/supabase.ts b/packages/core/src/integrations/supabase.ts index 39dedadc9e04..61005fdad805 100644 --- a/packages/core/src/integrations/supabase.ts +++ b/packages/core/src/integrations/supabase.ts @@ -302,12 +302,12 @@ function instrumentSupabaseAuthClient(supabaseClientInstance: SupabaseClientInst } function instrumentSupabaseClientConstructor(SupabaseClient: unknown): void { - if (isInstrumented((SupabaseClient as unknown as SupabaseClientConstructor).prototype.from)) { + if (isInstrumented((SupabaseClient as SupabaseClientConstructor).prototype.from)) { return; } - (SupabaseClient as unknown as SupabaseClientConstructor).prototype.from = new Proxy( - (SupabaseClient as unknown as SupabaseClientConstructor).prototype.from, + (SupabaseClient as SupabaseClientConstructor).prototype.from = new Proxy( + (SupabaseClient as SupabaseClientConstructor).prototype.from, { apply(target, thisArg, argumentsList) { const rv = Reflect.apply(target, thisArg, argumentsList); @@ -320,7 +320,7 @@ function instrumentSupabaseClientConstructor(SupabaseClient: unknown): void { }, ); - markAsInstrumented((SupabaseClient as unknown as SupabaseClientConstructor).prototype.from); + markAsInstrumented((SupabaseClient as SupabaseClientConstructor).prototype.from); } function instrumentPostgRESTFilterBuilder(PostgRESTFilterBuilder: PostgRESTFilterBuilder['constructor']): void { diff --git a/packages/core/src/tracing/sentrySpan.ts b/packages/core/src/tracing/sentrySpan.ts index af1a1f2b8ffc..9bd98b9741c6 100644 --- a/packages/core/src/tracing/sentrySpan.ts +++ b/packages/core/src/tracing/sentrySpan.ts @@ -24,7 +24,6 @@ import type { } from '../types-hoist/span'; import type { SpanStatus } from '../types-hoist/spanStatus'; import type { TimedEvent } from '../types-hoist/timedEvent'; -import type { TransactionSource } from '../types-hoist/transaction'; import { debug } from '../utils/debug-logger'; import { generateSpanId, generateTraceId } from '../utils/propagationContext'; import { @@ -347,7 +346,7 @@ export class SentrySpan implements Span { const spans = finishedSpans.map(span => spanToJSON(span)).filter(isFullFinishedSpan); - const source = this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] as TransactionSource | undefined; + const source = this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; // remove internal root span attributes we don't need to send. /* eslint-disable @typescript-eslint/no-dynamic-delete */ diff --git a/packages/core/src/utils/anthropic-ai/index.ts b/packages/core/src/utils/anthropic-ai/index.ts index f24707c4cc92..8cc44c188671 100644 --- a/packages/core/src/utils/anthropic-ai/index.ts +++ b/packages/core/src/utils/anthropic-ai/index.ts @@ -302,7 +302,7 @@ function createDeepProxy(target: T, currentPath = '', options: } if (value && typeof value === 'object') { - return createDeepProxy(value as object, methodPath, options); + return createDeepProxy(value, methodPath, options); } return value; diff --git a/packages/core/src/utils/debug-logger.ts b/packages/core/src/utils/debug-logger.ts index 6fc9c7a8c865..bbc524729674 100644 --- a/packages/core/src/utils/debug-logger.ts +++ b/packages/core/src/utils/debug-logger.ts @@ -47,7 +47,7 @@ export function consoleSandbox(callback: () => T): T { return callback(); } - const console = GLOBAL_OBJ.console as Console; + const console = GLOBAL_OBJ.console; const wrappedFuncs: Partial void>> = {}; const wrappedLevels = Object.keys(originalConsoleMethods) as ConsoleLevel[]; diff --git a/packages/core/src/utils/eventbuilder.ts b/packages/core/src/utils/eventbuilder.ts index 24889187712f..203d95ccc3a8 100644 --- a/packages/core/src/utils/eventbuilder.ts +++ b/packages/core/src/utils/eventbuilder.ts @@ -102,7 +102,7 @@ function getException( if (isPlainObject(exception)) { const normalizeDepth = client?.getOptions().normalizeDepth; - const extras = { ['__serialized__']: normalizeToSize(exception as Record, normalizeDepth) }; + const extras = { ['__serialized__']: normalizeToSize(exception, normalizeDepth) }; const errorFromProp = getErrorPropertyFromObject(exception); if (errorFromProp) { diff --git a/packages/core/src/utils/featureFlags.ts b/packages/core/src/utils/featureFlags.ts index 3e7be22704b6..4fa3cdc5ac8d 100644 --- a/packages/core/src/utils/featureFlags.ts +++ b/packages/core/src/utils/featureFlags.ts @@ -63,7 +63,7 @@ export function _INTERNAL_insertFlagToScope( if (!scopeContexts.flags) { scopeContexts.flags = { values: [] }; } - const flags = scopeContexts.flags.values as FeatureFlag[]; + const flags = scopeContexts.flags.values; _INTERNAL_insertToFlagBuffer(flags, name, value, maxSize); } diff --git a/packages/core/src/utils/google-genai/index.ts b/packages/core/src/utils/google-genai/index.ts index 13079cb34b49..58d7e2e6b5e6 100644 --- a/packages/core/src/utils/google-genai/index.ts +++ b/packages/core/src/utils/google-genai/index.ts @@ -278,7 +278,7 @@ function createDeepProxy(target: T, currentPath = '', options: return value; }, - }) as T; + }); } /** diff --git a/packages/core/src/utils/openai/index.ts b/packages/core/src/utils/openai/index.ts index d296df840112..4ecfad625062 100644 --- a/packages/core/src/utils/openai/index.ts +++ b/packages/core/src/utils/openai/index.ts @@ -201,7 +201,7 @@ function addRequestAttributes(span: Span, params: Record): void function getOptionsFromIntegration(): OpenAiOptions { const scope = getCurrentScope(); const client = scope.getClient(); - const integration = client?.getIntegrationByName(OPENAI_INTEGRATION_NAME) as OpenAiIntegration | undefined; + const integration = client?.getIntegrationByName(OPENAI_INTEGRATION_NAME); const shouldRecordInputsAndOutputs = integration ? Boolean(client?.getOptions().sendDefaultPii) : false; return { @@ -324,7 +324,7 @@ function createDeepProxy(target: T, currentPath = '', options? } if (value && typeof value === 'object') { - return createDeepProxy(value as object, methodPath, options); + return createDeepProxy(value, methodPath, options); } return value; diff --git a/packages/core/test/lib/integrations/captureconsole.test.ts b/packages/core/test/lib/integrations/captureconsole.test.ts index 8da7c6570d74..2ca059be4f86 100644 --- a/packages/core/test/lib/integrations/captureconsole.test.ts +++ b/packages/core/test/lib/integrations/captureconsole.test.ts @@ -134,7 +134,7 @@ describe('CaptureConsole setup', () => { expect(mockScope.addEventProcessor).toHaveBeenCalledTimes(1); - const addedEventProcessor = (mockScope.addEventProcessor as Mock).mock.calls[0]?.[0]; + const addedEventProcessor = mockScope.addEventProcessor.mock.calls[0]?.[0]; const someEvent: Event = {}; addedEventProcessor(someEvent); @@ -315,7 +315,7 @@ describe('CaptureConsole setup', () => { const someError = new Error('some error'); GLOBAL_OBJ.console.error(someError); - const addedEventProcessor = (mockScope.addEventProcessor as Mock).mock.calls[0]?.[0]; + const addedEventProcessor = mockScope.addEventProcessor.mock.calls[0]?.[0]; const someEvent: Event = { exception: { values: [{}], @@ -339,7 +339,7 @@ describe('CaptureConsole setup', () => { const someError = new Error('some error'); GLOBAL_OBJ.console.error(someError); - const addedEventProcessor = (mockScope.addEventProcessor as Mock).mock.calls[0]?.[0]; + const addedEventProcessor = mockScope.addEventProcessor.mock.calls[0]?.[0]; const someEvent: Event = { exception: { values: [{}], @@ -363,7 +363,7 @@ describe('CaptureConsole setup', () => { const someError = new Error('some error'); GLOBAL_OBJ.console.error(someError); - const addedEventProcessor = (mockScope.addEventProcessor as Mock).mock.calls[0]?.[0]; + const addedEventProcessor = mockScope.addEventProcessor.mock.calls[0]?.[0]; const someEvent: Event = { exception: { values: [{}], diff --git a/packages/core/test/lib/tracing/idleSpan.test.ts b/packages/core/test/lib/tracing/idleSpan.test.ts index 677428c941cd..3e930872945d 100644 --- a/packages/core/test/lib/tracing/idleSpan.test.ts +++ b/packages/core/test/lib/tracing/idleSpan.test.ts @@ -47,7 +47,7 @@ describe('startIdleSpan', () => { expect(getActiveSpan()).toBe(idleSpan); - idleSpan!.end(); + idleSpan.end(); vi.runAllTimers(); expect(getActiveSpan()).toBe(undefined); @@ -142,7 +142,7 @@ describe('startIdleSpan', () => { vi.advanceTimersByTime(TRACING_DEFAULTS.idleTimeout + 1); vi.runOnlyPendingTimers(); - expect(spanToJSON(idleSpan!).data).toEqual( + expect(spanToJSON(idleSpan).data).toEqual( expect.objectContaining({ foo: 'bar', }), @@ -693,7 +693,7 @@ describe('startIdleSpan', () => { vi.runAllTimers(); - expect(spanToJSON(idleSpan!).timestamp).toBe(1100); + expect(spanToJSON(idleSpan).timestamp).toBe(1100); }); it('trims end to final timeout', () => { @@ -713,7 +713,7 @@ describe('startIdleSpan', () => { vi.runAllTimers(); - expect(spanToJSON(idleSpan!).timestamp).toBe(1030); + expect(spanToJSON(idleSpan).timestamp).toBe(1030); }); it('keeps lower span endTime than highest child span end', () => { @@ -733,8 +733,8 @@ describe('startIdleSpan', () => { vi.runAllTimers(); - expect(spanToJSON(idleSpan!).timestamp).toBeLessThan(999_999_999); - expect(spanToJSON(idleSpan!).timestamp).toBeGreaterThan(1060); + expect(spanToJSON(idleSpan).timestamp).toBeLessThan(999_999_999); + expect(spanToJSON(idleSpan).timestamp).toBeGreaterThan(1060); }); }); }); diff --git a/packages/deno/src/integrations/normalizepaths.ts b/packages/deno/src/integrations/normalizepaths.ts index 4e7e599fb4d3..6a2bc6cd95aa 100644 --- a/packages/deno/src/integrations/normalizepaths.ts +++ b/packages/deno/src/integrations/normalizepaths.ts @@ -18,7 +18,7 @@ function appRootFromErrorStack(error: Error): string | undefined { .replace(/\\/g, '/') // replace all `\` instances with `/` .split('/') .filter(seg => seg !== ''), // remove empty segments - ) as string[][]; + ); const firstPath = paths[0]; diff --git a/packages/ember/tests/acceptance/sentry-replay-test.ts b/packages/ember/tests/acceptance/sentry-replay-test.ts index 87b8d849b799..ef9d318b2c6a 100644 --- a/packages/ember/tests/acceptance/sentry-replay-test.ts +++ b/packages/ember/tests/acceptance/sentry-replay-test.ts @@ -16,7 +16,7 @@ module('Acceptance | Sentry Session Replay', function (hooks) { Sentry.getClient()?.getIntegrationByName>('Replay'); assert.ok(integration); - const replay = integration!['_replay'] as ReturnType['_replay']; + const replay = integration!['_replay']; assert.true(replay.isEnabled()); assert.false(replay.isPaused()); diff --git a/packages/eslint-config-sdk/src/base.js b/packages/eslint-config-sdk/src/base.js index 52334507ac8b..5b77056bfbb2 100644 --- a/packages/eslint-config-sdk/src/base.js +++ b/packages/eslint-config-sdk/src/base.js @@ -59,6 +59,9 @@ module.exports = { // We want to use optional chaining, where possible, to safe bytes '@typescript-eslint/prefer-optional-chain': 'error', + // Disallow unnecessary type assertions/conversions + '@typescript-eslint/no-unnecessary-type-assertion': 'error', + // Private and protected members of a class should be prefixed with a leading underscore. // typeLike declarations (class, interface, typeAlias, enum, typeParameter) should be // PascalCase. diff --git a/packages/feedback/src/core/integration.ts b/packages/feedback/src/core/integration.ts index 87ab62cfec1b..9ce0feac921f 100644 --- a/packages/feedback/src/core/integration.ts +++ b/packages/feedback/src/core/integration.ts @@ -186,7 +186,7 @@ export const buildFeedbackIntegration = ({ _shadow = host.attachShadow({ mode: 'open' }); _shadow.appendChild(createMainStyles(options)); } - return _shadow as ShadowRoot; + return _shadow; }; const _loadAndRenderDialog = async ( diff --git a/packages/feedback/src/modal/integration.tsx b/packages/feedback/src/modal/integration.tsx index 5bdf4362509d..0e3f8a637149 100644 --- a/packages/feedback/src/modal/integration.tsx +++ b/packages/feedback/src/modal/integration.tsx @@ -24,7 +24,7 @@ export const feedbackModalIntegration = ((): FeedbackModalIntegration => { name: 'FeedbackModal', setupOnce() {}, createDialog: ({ options, screenshotIntegration, sendFeedback, shadow }) => { - const shadowRoot = shadow as unknown as ShadowRoot; + const shadowRoot = shadow as ShadowRoot; const userKey = options.useSentryUser; const user = getUser(); diff --git a/packages/google-cloud-serverless/test/gcpfunction/cloud_event.test.ts b/packages/google-cloud-serverless/test/gcpfunction/cloud_event.test.ts index 0cb6d502e934..8e7d80ee95b0 100644 --- a/packages/google-cloud-serverless/test/gcpfunction/cloud_event.test.ts +++ b/packages/google-cloud-serverless/test/gcpfunction/cloud_event.test.ts @@ -17,7 +17,7 @@ const mockSpan = { vi.mock('@sentry/node', async () => { // eslint-disable-next-line @typescript-eslint/consistent-type-imports - const original = (await vi.importActual('@sentry/node')) as typeof import('@sentry/node'); + const original = await vi.importActual('@sentry/node'); return { ...original, startSpanManual: (...args: unknown[]) => { diff --git a/packages/google-cloud-serverless/test/gcpfunction/events.test.ts b/packages/google-cloud-serverless/test/gcpfunction/events.test.ts index 7cb41a3c36e9..0dc7198ccdcf 100644 --- a/packages/google-cloud-serverless/test/gcpfunction/events.test.ts +++ b/packages/google-cloud-serverless/test/gcpfunction/events.test.ts @@ -18,7 +18,7 @@ const mockSpan = { vi.mock('@sentry/node', async () => { // eslint-disable-next-line @typescript-eslint/consistent-type-imports - const original = (await vi.importActual('@sentry/node')) as typeof import('@sentry/node'); + const original = await vi.importActual('@sentry/node'); return { ...original, startSpanManual: (...args: unknown[]) => { diff --git a/packages/google-cloud-serverless/test/gcpfunction/http.test.ts b/packages/google-cloud-serverless/test/gcpfunction/http.test.ts index 73cd262144e0..ce327c79cd54 100644 --- a/packages/google-cloud-serverless/test/gcpfunction/http.test.ts +++ b/packages/google-cloud-serverless/test/gcpfunction/http.test.ts @@ -20,7 +20,7 @@ const mockSpan = { vi.mock('@sentry/node', async () => { // eslint-disable-next-line @typescript-eslint/consistent-type-imports - const original = (await vi.importActual('@sentry/node')) as typeof import('@sentry/node'); + const original = await vi.importActual('@sentry/node'); return { ...original, init: (options: unknown) => { diff --git a/packages/google-cloud-serverless/test/integrations/google-cloud-http.test.ts b/packages/google-cloud-serverless/test/integrations/google-cloud-http.test.ts index 72a96e0b8e86..ce9ccee0a4ea 100644 --- a/packages/google-cloud-serverless/test/integrations/google-cloud-http.test.ts +++ b/packages/google-cloud-serverless/test/integrations/google-cloud-http.test.ts @@ -14,7 +14,7 @@ const mockStartInactiveSpan = vi.fn(spanArgs => ({ ...spanArgs })); vi.mock('@sentry/node', async () => { // eslint-disable-next-line @typescript-eslint/consistent-type-imports - const original = (await vi.importActual('@sentry/node')) as typeof import('@sentry/node'); + const original = await vi.importActual('@sentry/node'); return { ...original, startInactiveSpan: (ctx: unknown) => { diff --git a/packages/google-cloud-serverless/test/sdk.test.ts b/packages/google-cloud-serverless/test/sdk.test.ts index 9759ac2a5a43..a98cd8af47e6 100644 --- a/packages/google-cloud-serverless/test/sdk.test.ts +++ b/packages/google-cloud-serverless/test/sdk.test.ts @@ -5,7 +5,7 @@ const mockInit = vi.fn(); vi.mock('@sentry/node', async () => { // eslint-disable-next-line @typescript-eslint/consistent-type-imports - const original = (await vi.importActual('@sentry/node')) as typeof import('@sentry/node'); + const original = await vi.importActual('@sentry/node'); return { ...original, init: (options: unknown) => { diff --git a/packages/integration-shims/src/Feedback.ts b/packages/integration-shims/src/Feedback.ts index 327b2d40401f..dd56bd273717 100644 --- a/packages/integration-shims/src/Feedback.ts +++ b/packages/integration-shims/src/Feedback.ts @@ -22,10 +22,10 @@ export const feedbackIntegrationShim = Object.assign( return { name: 'Feedback', - ...(FEEDBACK_INTEGRATION_METHODS.reduce((acc, method) => { + ...FEEDBACK_INTEGRATION_METHODS.reduce((acc, method) => { acc[method] = FAKE_FUNCTION; return acc; - }, {} as FeedbackSpecificMethods) as FeedbackSpecificMethods), + }, {} as FeedbackSpecificMethods), }; }, { diff --git a/packages/integration-shims/src/Replay.ts b/packages/integration-shims/src/Replay.ts index 6774b9308c23..eee5cfbb2ef7 100644 --- a/packages/integration-shims/src/Replay.ts +++ b/packages/integration-shims/src/Replay.ts @@ -21,9 +21,9 @@ export function replayIntegrationShim(_options: unknown): ReplayIntegration { return { name: 'Replay', - ...(REPLAY_INTEGRATION_METHODS.reduce((acc, method) => { + ...REPLAY_INTEGRATION_METHODS.reduce((acc, method) => { acc[method] = FAKE_FUNCTION; return acc; - }, {} as ReplaySpecificMethods) as ReplaySpecificMethods), + }, {} as ReplaySpecificMethods), }; } diff --git a/packages/nestjs/src/setup.ts b/packages/nestjs/src/setup.ts index cc6d65514b77..2d4255df9b3f 100644 --- a/packages/nestjs/src/setup.ts +++ b/packages/nestjs/src/setup.ts @@ -54,7 +54,7 @@ class SentryTracingInterceptor implements NestInterceptor { } if (context.getType() === 'http') { - const req = context.switchToHttp().getRequest() as FastifyRequest | ExpressRequest; + const req = context.switchToHttp().getRequest(); if ('routeOptions' in req && req.routeOptions?.url) { // fastify case getIsolationScope().setTransactionName(`${(req.method || 'GET').toUpperCase()} ${req.routeOptions.url}`); diff --git a/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts b/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts index d8e931e06451..3a05c97d5f5c 100644 --- a/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts +++ b/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts @@ -41,7 +41,7 @@ function wrapHandler(handler: T, method: 'GET' | 'POST' | 'PUT' | 'PATCH' | ' // We try-catch here just in case the API around `requestAsyncStorage` changes unexpectedly since it is not public API try { - const requestAsyncStore = requestAsyncStorage?.getStore() as ReturnType; + const requestAsyncStore = requestAsyncStorage?.getStore(); headers = requestAsyncStore?.headers; } catch { /** empty */ diff --git a/packages/nextjs/src/config/templates/serverComponentWrapperTemplate.ts b/packages/nextjs/src/config/templates/serverComponentWrapperTemplate.ts index f29df45d3542..7a1320c3517f 100644 --- a/packages/nextjs/src/config/templates/serverComponentWrapperTemplate.ts +++ b/packages/nextjs/src/config/templates/serverComponentWrapperTemplate.ts @@ -46,7 +46,7 @@ if (typeof serverComponent === 'function') { // We try-catch here just in `requestAsyncStorage` is undefined since it may not be defined try { - const requestAsyncStore = requestAsyncStorage?.getStore() as ReturnType; + const requestAsyncStore = requestAsyncStorage?.getStore(); sentryTraceHeader = requestAsyncStore?.headers.get('sentry-trace') ?? undefined; baggageHeader = requestAsyncStore?.headers.get('baggage') ?? undefined; headers = requestAsyncStore?.headers; diff --git a/packages/nextjs/test/config/mocks.ts b/packages/nextjs/test/config/mocks.ts index 2aa174877beb..0e9c48146585 100644 --- a/packages/nextjs/test/config/mocks.ts +++ b/packages/nextjs/test/config/mocks.ts @@ -16,7 +16,7 @@ vi.mock('os'); // function also lets us restore the original when we do want to test // `getUserConfigFile()`. // eslint-disable-next-line @typescript-eslint/consistent-type-imports -const fsReal = (await vi.importActual('fs')) as typeof import('fs'); +const fsReal = await vi.importActual('fs'); export const realExistsSync = fsReal.existsSync; export const mockExistsSync = (path: fs.PathLike): ReturnType => { if ( @@ -37,7 +37,7 @@ export const exitsSync = vi.spyOn(fs, 'existsSync').mockImplementation(mockExist // Make it so that all temporary folders, either created directly by tests or by the code they're testing, will go into // one spot that we know about, which we can then clean up when we're done // eslint-disable-next-line @typescript-eslint/consistent-type-imports -const osReal = (await vi.importActual('os')) as typeof import('os'); +const osReal = await vi.importActual('os'); const realTmpdir = osReal.tmpdir; // Including the random number ensures that even if multiple test files using these mocks are running at once, they have diff --git a/packages/node-core/src/integrations/context.ts b/packages/node-core/src/integrations/context.ts index aca94a70db7a..cad8a1c4a443 100644 --- a/packages/node-core/src/integrations/context.ts +++ b/packages/node-core/src/integrations/context.ts @@ -389,7 +389,7 @@ async function getLinuxInfo(): Promise { // usually quite small, this should not allocate too much memory and we only // hold on to it for a very short amount of time. const distroPath = join('/etc', distroFile.name); - const contents = ((await readFileAsync(distroPath, { encoding: 'utf-8' })) as string).toLowerCase(); + const contents = (await readFileAsync(distroPath, { encoding: 'utf-8' })).toLowerCase(); // Some Linux distributions store their release information in the same file // (e.g. RHEL and Centos). In those cases, we scan the file for an diff --git a/packages/node-core/src/integrations/http/incoming-requests.ts b/packages/node-core/src/integrations/http/incoming-requests.ts index 57588d0ac16e..e2de19f77582 100644 --- a/packages/node-core/src/integrations/http/incoming-requests.ts +++ b/packages/node-core/src/integrations/http/incoming-requests.ts @@ -489,7 +489,7 @@ function getContentLength(headers: IncomingHttpHeaders): number | null { const contentLengthHeader = headers['content-length']; if (contentLengthHeader === undefined) return null; - const contentLength = parseInt(contentLengthHeader as string, 10); + const contentLength = parseInt(contentLengthHeader, 10); if (isNaN(contentLength)) return null; return contentLength; diff --git a/packages/node-core/test/integrations/context.test.ts b/packages/node-core/test/integrations/context.test.ts index a22bfcf6ec34..c6ca3ad6a4da 100644 --- a/packages/node-core/test/integrations/context.test.ts +++ b/packages/node-core/test/integrations/context.test.ts @@ -5,7 +5,7 @@ import { conditionalTest } from '../helpers/conditional'; vi.mock('node:os', async () => { // eslint-disable-next-line @typescript-eslint/consistent-type-imports - const original = (await vi.importActual('node:os')) as typeof import('node:os'); + const original = await vi.importActual('node:os'); return { ...original, uptime: original.uptime, diff --git a/packages/node-core/test/integrations/contextlines.test.ts b/packages/node-core/test/integrations/contextlines.test.ts index 2965acded28f..332cd9b2e51e 100644 --- a/packages/node-core/test/integrations/contextlines.test.ts +++ b/packages/node-core/test/integrations/contextlines.test.ts @@ -13,7 +13,7 @@ import { getError } from '../helpers/error'; vi.mock('node:fs', async () => { // eslint-disable-next-line @typescript-eslint/consistent-type-imports - const original = (await vi.importActual('node:fs')) as typeof import('node:fs'); + const original = await vi.importActual('node:fs'); return { ...original, createReadStream: original.createReadStream, diff --git a/packages/node-core/test/integrations/spotlight.test.ts b/packages/node-core/test/integrations/spotlight.test.ts index 19d52ebcdb21..6d8e6b0bcfc2 100644 --- a/packages/node-core/test/integrations/spotlight.test.ts +++ b/packages/node-core/test/integrations/spotlight.test.ts @@ -8,7 +8,7 @@ import { getDefaultNodeClientOptions } from '../helpers/getDefaultNodeClientOpti vi.mock('node:http', async () => { // eslint-disable-next-line @typescript-eslint/consistent-type-imports - const original = (await vi.importActual('node:http')) as typeof import('node:http'); + const original = await vi.importActual('node:http'); return { ...original, request: original.request, diff --git a/packages/node-core/test/sdk/init.test.ts b/packages/node-core/test/sdk/init.test.ts index c0c574ab2b35..4262bffb7cda 100644 --- a/packages/node-core/test/sdk/init.test.ts +++ b/packages/node-core/test/sdk/init.test.ts @@ -101,7 +101,7 @@ describe('init()', () => { expect(mockDefaultIntegrations[0]?.setupOnce as Mock).toHaveBeenCalledTimes(1); expect(mockDefaultIntegrations[1]?.setupOnce as Mock).toHaveBeenCalledTimes(0); - expect(newIntegration.setupOnce as Mock).toHaveBeenCalledTimes(1); + expect(newIntegration.setupOnce).toHaveBeenCalledTimes(1); }); }); diff --git a/packages/node-core/test/transports/http.test.ts b/packages/node-core/test/transports/http.test.ts index 0f01fdc5639a..e33bcb542bbd 100644 --- a/packages/node-core/test/transports/http.test.ts +++ b/packages/node-core/test/transports/http.test.ts @@ -14,7 +14,7 @@ import { makeNodeTransport } from '../../src/transports'; vi.mock('@sentry/core', async () => { // eslint-disable-next-line @typescript-eslint/consistent-type-imports - const actualCore = (await vi.importActual('@sentry/core')) as typeof import('@sentry/core'); + const actualCore = await vi.importActual('@sentry/core'); return { ...actualCore, createTransport: vi.fn().mockImplementation(actualCore.createTransport), @@ -23,7 +23,7 @@ vi.mock('@sentry/core', async () => { vi.mock('node:http', async () => { // eslint-disable-next-line @typescript-eslint/consistent-type-imports - const original = (await vi.importActual('node:http')) as typeof import('node:http'); + const original = await vi.importActual('node:http'); return { ...original, request: original.request, diff --git a/packages/node-core/test/transports/https.test.ts b/packages/node-core/test/transports/https.test.ts index bb4147a20133..ec9fc0aa8204 100644 --- a/packages/node-core/test/transports/https.test.ts +++ b/packages/node-core/test/transports/https.test.ts @@ -10,7 +10,7 @@ import testServerCerts from './test-server-certs'; vi.mock('@sentry/core', async () => { // eslint-disable-next-line @typescript-eslint/consistent-type-imports - const actualCore = (await vi.importActual('@sentry/core')) as typeof import('@sentry/core'); + const actualCore = await vi.importActual('@sentry/core'); return { ...actualCore, createTransport: vi.fn().mockImplementation(actualCore.createTransport), diff --git a/packages/node/src/integrations/tracing/fastify/index.ts b/packages/node/src/integrations/tracing/fastify/index.ts index 084c50a6957e..0ad069ea1f4e 100644 --- a/packages/node/src/integrations/tracing/fastify/index.ts +++ b/packages/node/src/integrations/tracing/fastify/index.ts @@ -101,7 +101,7 @@ function getFastifyIntegration(): ReturnType | undef if (!client) { return undefined; } else { - return client.getIntegrationByName(INTEGRATION_NAME) as ReturnType | undefined; + return client.getIntegrationByName(INTEGRATION_NAME); } } diff --git a/packages/node/src/integrations/tracing/firebase/firebase.ts b/packages/node/src/integrations/tracing/firebase/firebase.ts index 9f2abbfe31fd..649a7089289b 100644 --- a/packages/node/src/integrations/tracing/firebase/firebase.ts +++ b/packages/node/src/integrations/tracing/firebase/firebase.ts @@ -1,4 +1,3 @@ -import type { Span } from '@opentelemetry/api'; import type { IntegrationFn } from '@sentry/core'; import { defineIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core'; import { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core'; @@ -8,7 +7,7 @@ const INTEGRATION_NAME = 'Firebase'; const config: FirebaseInstrumentationConfig = { firestoreSpanCreationHook: span => { - addOriginToSpan(span as Span, 'auto.firebase.otel.firestore'); + addOriginToSpan(span, 'auto.firebase.otel.firestore'); span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'db.query'); }, diff --git a/packages/node/src/integrations/tracing/google-genai/instrumentation.ts b/packages/node/src/integrations/tracing/google-genai/instrumentation.ts index cfdb68973be6..e604e0c99cd3 100644 --- a/packages/node/src/integrations/tracing/google-genai/instrumentation.ts +++ b/packages/node/src/integrations/tracing/google-genai/instrumentation.ts @@ -69,7 +69,7 @@ export class SentryGoogleGenAiInstrumentation extends InstrumentationBase(input: NestedArray): T[] { const flattenHelper = (input: NestedArray): void => { input.forEach((el: T | NestedArray) => { if (Array.isArray(el)) { - flattenHelper(el as NestedArray); + flattenHelper(el); } else { - result.push(el as T); + result.push(el); } }); }; diff --git a/packages/node/test/sdk/init.test.ts b/packages/node/test/sdk/init.test.ts index 422bbdc924f4..da6680fc622f 100644 --- a/packages/node/test/sdk/init.test.ts +++ b/packages/node/test/sdk/init.test.ts @@ -111,7 +111,7 @@ describe('init()', () => { expect(mockDefaultIntegrations[0]?.setupOnce as Mock).toHaveBeenCalledTimes(1); expect(mockDefaultIntegrations[1]?.setupOnce as Mock).toHaveBeenCalledTimes(0); - expect(newIntegration.setupOnce as Mock).toHaveBeenCalledTimes(1); + expect(newIntegration.setupOnce).toHaveBeenCalledTimes(1); expect(mockAutoPerformanceIntegrations).toHaveBeenCalledTimes(0); }); @@ -133,7 +133,7 @@ describe('init()', () => { expect(mockIntegrations[0]?.setupOnce as Mock).toHaveBeenCalledTimes(1); expect(mockIntegrations[1]?.setupOnce as Mock).toHaveBeenCalledTimes(1); - expect(autoPerformanceIntegration.setupOnce as Mock).toHaveBeenCalledTimes(1); + expect(autoPerformanceIntegration.setupOnce).toHaveBeenCalledTimes(1); expect(mockAutoPerformanceIntegrations).toHaveBeenCalledTimes(1); const client = getClient(); diff --git a/packages/react-router/test/server/lowQualityTransactionsFilterIntegration.test.ts b/packages/react-router/test/server/lowQualityTransactionsFilterIntegration.test.ts index 4f43b48dcad9..7edd75c9e996 100644 --- a/packages/react-router/test/server/lowQualityTransactionsFilterIntegration.test.ts +++ b/packages/react-router/test/server/lowQualityTransactionsFilterIntegration.test.ts @@ -1,4 +1,4 @@ -import type { Event, EventType, Integration } from '@sentry/core'; +import type { Event, EventType } from '@sentry/core'; import * as SentryCore from '@sentry/core'; import * as SentryNode from '@sentry/node'; import { afterEach, describe, expect, it, vi } from 'vitest'; @@ -20,7 +20,7 @@ describe('Low Quality Transactions Filter Integration', () => { ['@id/ requests', 'GET /@id/some-id'], ['manifest requests', 'GET /__manifest?p=%2Fperformance%2Fserver-action'], ])('%s', (description, transaction) => { - const integration = lowQualityTransactionsFilterIntegration({ debug: true }) as Integration; + const integration = lowQualityTransactionsFilterIntegration({ debug: true }); const event = { type: 'transaction' as EventType, transaction, @@ -40,7 +40,7 @@ describe('Low Quality Transactions Filter Integration', () => { ['API endpoints', 'POST /data'], ['app routes', 'GET /projects/123'], ])('%s', (description, transaction) => { - const integration = lowQualityTransactionsFilterIntegration({}) as Integration; + const integration = lowQualityTransactionsFilterIntegration({}); const event = { type: 'transaction' as EventType, transaction, @@ -53,7 +53,7 @@ describe('Low Quality Transactions Filter Integration', () => { }); it('does not affect non-transaction events', () => { - const integration = lowQualityTransactionsFilterIntegration({}) as Integration; + const integration = lowQualityTransactionsFilterIntegration({}); const event = { type: 'error' as EventType, transaction: 'GET /node_modules/some-package/index.js', diff --git a/packages/remix/src/server/sdk.ts b/packages/remix/src/server/sdk.ts index 145cb8a66b47..f191a336cfbb 100644 --- a/packages/remix/src/server/sdk.ts +++ b/packages/remix/src/server/sdk.ts @@ -18,7 +18,7 @@ export function getRemixDefaultIntegrations(options: RemixOptions): Integration[ ...getDefaultNodeIntegrations(options as NodeOptions).filter(integration => integration.name !== 'Http'), httpIntegration(), remixIntegration(), - ].filter(int => int) as Integration[]; + ].filter(int => int); } /** Initializes Sentry Remix SDK on Node. */ diff --git a/packages/replay-internal/test/unit/session/createSession.test.ts b/packages/replay-internal/test/unit/session/createSession.test.ts index 53fbbbdb59e5..a30f13401502 100644 --- a/packages/replay-internal/test/unit/session/createSession.test.ts +++ b/packages/replay-internal/test/unit/session/createSession.test.ts @@ -12,7 +12,7 @@ vi.mock('./../../../src/session/saveSession'); vi.mock('@sentry/core', async () => { return { - ...((await vi.importActual('@sentry/core')) as { string: unknown }), + ...(await vi.importActual('@sentry/core')), uuid4: vi.fn(() => 'test_session_id'), }; }); diff --git a/packages/replay-internal/test/unit/session/loadOrCreateSession.test.ts b/packages/replay-internal/test/unit/session/loadOrCreateSession.test.ts index b59c14aa4e4d..273d401a7afc 100644 --- a/packages/replay-internal/test/unit/session/loadOrCreateSession.test.ts +++ b/packages/replay-internal/test/unit/session/loadOrCreateSession.test.ts @@ -14,7 +14,7 @@ import type { SessionOptions } from '../../../src/types'; vi.mock('@sentry/core', async () => { return { - ...((await vi.importActual('@sentry/core')) as { string: unknown }), + ...(await vi.importActual('@sentry/core')), uuid4: vi.fn(() => 'test_session_uuid'), }; }); diff --git a/packages/sveltekit/test/server-common/serverRoute.test.ts b/packages/sveltekit/test/server-common/serverRoute.test.ts index 2ec3ef2cf2d2..1edfb6da6ebd 100644 --- a/packages/sveltekit/test/server-common/serverRoute.test.ts +++ b/packages/sveltekit/test/server-common/serverRoute.test.ts @@ -31,7 +31,7 @@ describe('wrapServerRouteWithSentry', () => { it('assigns the route id as name if available', () => { const wrappedRouteHandler = wrapServerRouteWithSentry(originalRouteHandler); - wrappedRouteHandler(getRequestEventMock() as RequestEvent); + wrappedRouteHandler(getRequestEventMock()); expect(startSpanSpy).toHaveBeenCalledWith( { @@ -81,7 +81,7 @@ describe('wrapServerRouteWithSentry', () => { }); await expect(async () => { - await wrappedRouteHandler(getRequestEventMock() as RequestEvent); + await wrappedRouteHandler(getRequestEventMock()); }).rejects.toThrowError('Server Route Error'); expect(captureExceptionSpy).toHaveBeenCalledWith(error, { @@ -95,7 +95,7 @@ describe('wrapServerRouteWithSentry', () => { }); await expect(async () => { - await wrappedRouteHandler(getRequestEventMock() as RequestEvent); + await wrappedRouteHandler(getRequestEventMock()); }).rejects.toThrow(); expect(captureExceptionSpy).toHaveBeenCalledWith( @@ -115,7 +115,7 @@ describe('wrapServerRouteWithSentry', () => { }); await expect(async () => { - await wrappedRouteHandler(getRequestEventMock() as RequestEvent); + await wrappedRouteHandler(getRequestEventMock()); }).rejects.toThrow(); expect(captureExceptionSpy).not.toHaveBeenCalled(); @@ -127,7 +127,7 @@ describe('wrapServerRouteWithSentry', () => { }); await expect(async () => { - await wrappedRouteHandler(getRequestEventMock() as RequestEvent); + await wrappedRouteHandler(getRequestEventMock()); }).rejects.toThrow(); expect(captureExceptionSpy).not.toHaveBeenCalled(); diff --git a/packages/vercel-edge/test/wintercg-fetch.test.ts b/packages/vercel-edge/test/wintercg-fetch.test.ts index cb5506a71e05..a413cc7e93da 100644 --- a/packages/vercel-edge/test/wintercg-fetch.test.ts +++ b/packages/vercel-edge/test/wintercg-fetch.test.ts @@ -8,7 +8,7 @@ import { winterCGFetchIntegration } from '../src/integrations/wintercg-fetch'; class FakeClient extends VercelEdgeClient { public getIntegrationByName(name: string): T | undefined { - return name === 'WinterCGFetch' ? (winterCGFetchIntegration() as Integration as T) : undefined; + return name === 'WinterCGFetch' ? (winterCGFetchIntegration() as T) : undefined; } }