Skip to content

Commit 9602244

Browse files
committed
remove SpanJSON type casting
1 parent 0c637ec commit 9602244

File tree

6 files changed

+15
-21
lines changed

6 files changed

+15
-21
lines changed

dev-packages/e2e-tests/test-applications/nestjs-distributed-tracing/tests/propagation.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => {
2626
const outboundTransaction = await outboundTransactionPromise;
2727

2828
const traceId = outboundTransaction?.contexts?.trace?.trace_id;
29-
const outgoingHttpSpan = outboundTransaction?.spans?.find(span => span.op === 'http.client') as SpanJSON | undefined;
29+
const outgoingHttpSpan = outboundTransaction?.spans?.find(span => span.op === 'http.client');
3030

3131
expect(outgoingHttpSpan).toBeDefined();
3232

dev-packages/e2e-tests/test-applications/node-fastify-3/tests/propagation.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import crypto from 'crypto';
22
import { expect, test } from '@playwright/test';
33
import { waitForTransaction } from '@sentry-internal/test-utils';
4-
import { SpanJSON } from '@sentry/core';
54

65
test('Propagates trace for outgoing http requests', async ({ baseURL }) => {
76
const id = crypto.randomUUID();
@@ -27,7 +26,7 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => {
2726
const outboundTransaction = await outboundTransactionPromise;
2827

2928
const traceId = outboundTransaction?.contexts?.trace?.trace_id;
30-
const outgoingHttpSpan = outboundTransaction?.spans?.find(span => span.op === 'http.client') as SpanJSON | undefined;
29+
const outgoingHttpSpan = outboundTransaction?.spans?.find(span => span.op === 'http.client');
3130

3231
expect(outgoingHttpSpan).toBeDefined();
3332

@@ -141,7 +140,7 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => {
141140
const outboundTransaction = await outboundTransactionPromise;
142141

143142
const traceId = outboundTransaction?.contexts?.trace?.trace_id;
144-
const outgoingHttpSpan = outboundTransaction?.spans?.find(span => span.op === 'http.client') as SpanJSON | undefined;
143+
const outgoingHttpSpan = outboundTransaction?.spans?.find(span => span.op === 'http.client');
145144

146145
expect(outgoingHttpSpan).toBeDefined();
147146

dev-packages/e2e-tests/test-applications/node-fastify-4/tests/propagation.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import crypto from 'crypto';
22
import { expect, test } from '@playwright/test';
33
import { waitForTransaction } from '@sentry-internal/test-utils';
4-
import { SpanJSON } from '@sentry/core';
54

65
test('Propagates trace for outgoing http requests', async ({ baseURL }) => {
76
const id = crypto.randomUUID();
@@ -27,7 +26,7 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => {
2726
const outboundTransaction = await outboundTransactionPromise;
2827

2928
const traceId = outboundTransaction?.contexts?.trace?.trace_id;
30-
const outgoingHttpSpan = outboundTransaction?.spans?.find(span => span.op === 'http.client') as SpanJSON | undefined;
29+
const outgoingHttpSpan = outboundTransaction?.spans?.find(span => span.op === 'http.client');
3130

3231
expect(outgoingHttpSpan).toBeDefined();
3332

@@ -141,7 +140,7 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => {
141140
const outboundTransaction = await outboundTransactionPromise;
142141

143142
const traceId = outboundTransaction?.contexts?.trace?.trace_id;
144-
const outgoingHttpSpan = outboundTransaction?.spans?.find(span => span.op === 'http.client') as SpanJSON | undefined;
143+
const outgoingHttpSpan = outboundTransaction?.spans?.find(span => span.op === 'http.client');
145144

146145
expect(outgoingHttpSpan).toBeDefined();
147146

dev-packages/e2e-tests/test-applications/node-fastify-5/tests/propagation.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import crypto from 'crypto';
22
import { expect, test } from '@playwright/test';
33
import { waitForTransaction } from '@sentry-internal/test-utils';
4-
import { SpanJSON } from '@sentry/core';
54

65
test('Propagates trace for outgoing http requests', async ({ baseURL }) => {
76
const id = crypto.randomUUID();
@@ -27,7 +26,7 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => {
2726
const outboundTransaction = await outboundTransactionPromise;
2827

2928
const traceId = outboundTransaction?.contexts?.trace?.trace_id;
30-
const outgoingHttpSpan = outboundTransaction?.spans?.find(span => span.op === 'http.client') as SpanJSON | undefined;
29+
const outgoingHttpSpan = outboundTransaction?.spans?.find(span => span.op === 'http.client');
3130

3231
expect(outgoingHttpSpan).toBeDefined();
3332

@@ -141,7 +140,7 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => {
141140
const outboundTransaction = await outboundTransactionPromise;
142141

143142
const traceId = outboundTransaction?.contexts?.trace?.trace_id;
144-
const outgoingHttpSpan = outboundTransaction?.spans?.find(span => span.op === 'http.client') as SpanJSON | undefined;
143+
const outgoingHttpSpan = outboundTransaction?.spans?.find(span => span.op === 'http.client');
145144

146145
expect(outgoingHttpSpan).toBeDefined();
147146

dev-packages/e2e-tests/test-applications/node-koa/tests/propagation.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import crypto from 'crypto';
22
import { expect, test } from '@playwright/test';
33
import { waitForTransaction } from '@sentry-internal/test-utils';
4-
import { SpanJSON } from '@sentry/core';
54

65
test('Propagates trace for outgoing http requests', async ({ baseURL }) => {
76
const id = crypto.randomUUID();
@@ -27,8 +26,7 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => {
2726
const outboundTransaction = await outboundTransactionPromise;
2827

2928
const traceId = outboundTransaction?.contexts?.trace?.trace_id;
30-
const outgoingHttpSpan = outboundTransaction?.spans?.find(span => span.op === 'http.client') as SpanJSON | undefined;
31-
29+
const outgoingHttpSpan = outboundTransaction?.spans?.find(span => span.op === 'http.client');
3230
expect(outgoingHttpSpan).toBeDefined();
3331

3432
const outgoingHttpSpanId = outgoingHttpSpan?.span_id;
@@ -141,7 +139,7 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => {
141139
const outboundTransaction = await outboundTransactionPromise;
142140

143141
const traceId = outboundTransaction?.contexts?.trace?.trace_id;
144-
const outgoingHttpSpan = outboundTransaction?.spans?.find(span => span.op === 'http.client') as SpanJSON | undefined;
142+
const outgoingHttpSpan = outboundTransaction?.spans?.find(span => span.op === 'http.client');
145143

146144
expect(outgoingHttpSpan).toBeDefined();
147145

dev-packages/e2e-tests/test-applications/react-router-6/tests/sse.test.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { expect, test } from '@playwright/test';
22
import { waitForTransaction } from '@sentry-internal/test-utils';
3-
import { SpanJSON } from '@sentry/core';
43

54
test('Waits for sse streaming when creating spans', async ({ page }) => {
65
await page.goto('/sse');
@@ -13,8 +12,8 @@ test('Waits for sse streaming when creating spans', async ({ page }) => {
1312
await fetchButton.click();
1413

1514
const rootSpan = await transactionPromise;
16-
const sseFetchCall = rootSpan.spans?.filter(span => span.description === 'sse fetch call')[0] as SpanJSON;
17-
const httpGet = rootSpan.spans?.filter(span => span.description === 'GET http://localhost:8080/sse')[0] as SpanJSON;
15+
const sseFetchCall = rootSpan.spans?.filter(span => span.description === 'sse fetch call')[0]!;
16+
const httpGet = rootSpan.spans?.filter(span => span.description === 'GET http://localhost:8080/sse')[0]!;
1817

1918
expect(sseFetchCall).toBeDefined();
2019
expect(httpGet).toBeDefined();
@@ -45,8 +44,8 @@ test('Waits for sse streaming when sse has been explicitly aborted', async ({ pa
4544
await fetchButton.click();
4645

4746
const rootSpan = await transactionPromise;
48-
const sseFetchCall = rootSpan.spans?.filter(span => span.description === 'sse fetch call')[0] as SpanJSON;
49-
const httpGet = rootSpan.spans?.filter(span => span.description === 'GET http://localhost:8080/sse')[0] as SpanJSON;
47+
const sseFetchCall = rootSpan.spans?.filter(span => span.description === 'sse fetch call')[0]!;
48+
const httpGet = rootSpan.spans?.filter(span => span.description === 'GET http://localhost:8080/sse')[0]!;
5049

5150
expect(sseFetchCall).toBeDefined();
5251
expect(httpGet).toBeDefined();
@@ -85,10 +84,10 @@ test('Aborts when stream takes longer than 5s, by not updating the span duration
8584
await fetchButton.click();
8685

8786
const rootSpan = await transactionPromise;
88-
const sseFetchCall = rootSpan.spans?.filter(span => span.description === 'sse fetch call')[0] as SpanJSON;
87+
const sseFetchCall = rootSpan.spans?.filter(span => span.description === 'sse fetch call')[0]!;
8988
const httpGet = rootSpan.spans?.filter(
9089
span => span.description === 'GET http://localhost:8080/sse-timeout',
91-
)[0] as SpanJSON;
90+
)[0]!;
9291

9392
expect(sseFetchCall).toBeDefined();
9493
expect(httpGet).toBeDefined();

0 commit comments

Comments
 (0)