Skip to content

Commit 6cedabe

Browse files
authored
Merge 483810c into 8957c95
2 parents 8957c95 + 483810c commit 6cedabe

File tree

12 files changed

+49
-48
lines changed

12 files changed

+49
-48
lines changed

packages/core/src/js/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export class ReactNativeClient extends Client<ReactNativeClientOptions> {
116116
public close(): PromiseLike<boolean> {
117117
// As super.close() flushes queued events, we wait for that to finish before closing the native SDK.
118118
return super.close().then((result: boolean) => {
119-
return NATIVE.closeNativeSdk().then(() => result) as PromiseLike<boolean>;
119+
return NATIVE.closeNativeSdk().then(() => result);
120120
});
121121
}
122122

packages/core/src/js/touchevents.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ function getFileName(props: Record<string, unknown>): string | undefined {
283283

284284
function getLabelValue(props: Record<string, unknown>, labelKey: string | undefined): string | undefined {
285285
return typeof props[SENTRY_LABEL_PROP_KEY] === 'string' && props[SENTRY_LABEL_PROP_KEY].length > 0
286-
? props[SENTRY_LABEL_PROP_KEY] as string
286+
? props[SENTRY_LABEL_PROP_KEY]
287287
// For some reason type narrowing doesn't work as expected with indexing when checking it all in one go in
288288
// the "check-label" if sentence, so we have to assign it to a variable here first
289289
: typeof labelKey === 'string' && typeof props[labelKey] == 'string' && (props[labelKey] as string).length > 0

packages/core/src/js/tracing/reactnativetracing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,5 +172,5 @@ export function getCurrentReactNativeTracingIntegration(): ReactNativeTracingInt
172172
* Returns React Native Tracing integration of given client.
173173
*/
174174
export function getReactNativeTracingIntegration(client: Client): ReactNativeTracingIntegration | undefined {
175-
return client.getIntegrationByName(INTEGRATION_NAME) as ReactNativeTracingIntegration | undefined;
175+
return client.getIntegrationByName(INTEGRATION_NAME);
176176
}

packages/core/src/js/tracing/reactnavigation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export const reactNavigationIntegration = ({
177177
debug.log(`${INTEGRATION_NAME} Navigation container ref is the same as the one already registered.`);
178178
return;
179179
}
180-
navigationContainer = newNavigationContainer as NavigationContainer;
180+
navigationContainer = newNavigationContainer;
181181

182182
if (!navigationContainer) {
183183
debug.warn(`${INTEGRATION_NAME} Received invalid navigation container ref!`);

packages/core/src/js/wrapper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ export const NATIVE: SentryNativeWrapper = {
259259
throw this._NativeClientError;
260260
}
261261
const ignoreErrorsStr = options.ignoreErrors?.filter(item => typeof item === 'string') as string[] | undefined;
262+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
262263
const ignoreErrorsRegex = options.ignoreErrors
263264
?.filter(item => item instanceof RegExp)
264265
.map(item => (item as RegExp).source) as string[] | undefined;

packages/core/test/integrations/logEnricherIntegration.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ describe('LogEnricher Integration', () => {
161161
// Extract the log handler
162162
const beforeCaptureLogCall = mockOn.mock.calls.find(call => call[0] === 'beforeCaptureLog');
163163
expect(beforeCaptureLogCall).toBeDefined();
164-
logHandler = beforeCaptureLogCall![1] as (log: Log) => void;
164+
logHandler = beforeCaptureLogCall[1];
165165

166166
mockLog = {
167167
message: 'Test log message',
@@ -245,7 +245,7 @@ describe('LogEnricher Integration', () => {
245245

246246
const beforeCaptureLogCall = mockOn.mock.calls.find(call => call[0] === 'beforeCaptureLog');
247247
expect(beforeCaptureLogCall).toBeDefined();
248-
const newLogHandler = beforeCaptureLogCall![1] as (log: Log) => void;
248+
const newLogHandler = beforeCaptureLogCall[1];
249249

250250
newLogHandler(mockLog);
251251

@@ -291,7 +291,7 @@ describe('LogEnricher Integration', () => {
291291

292292
const beforeCaptureLogCall = mockOn.mock.calls.find(call => call[0] === 'beforeCaptureLog');
293293
expect(beforeCaptureLogCall).toBeDefined();
294-
const emptyLogHandler = beforeCaptureLogCall![1] as (log: Log) => void;
294+
const emptyLogHandler = beforeCaptureLogCall[1];
295295

296296
emptyLogHandler(mockLog);
297297

@@ -323,7 +323,7 @@ describe('LogEnricher Integration', () => {
323323

324324
const beforeCaptureLogCall = mockOn.mock.calls.find(call => call[0] === 'beforeCaptureLog');
325325
expect(beforeCaptureLogCall).toBeDefined();
326-
const partialLogHandler = beforeCaptureLogCall![1] as (log: Log) => void;
326+
const partialLogHandler = beforeCaptureLogCall[1];
327327

328328
partialLogHandler(mockLog);
329329

@@ -357,7 +357,7 @@ describe('LogEnricher Integration', () => {
357357

358358
const beforeCaptureLogCall = mockOn.mock.calls.find(call => call[0] === 'beforeCaptureLog');
359359
expect(beforeCaptureLogCall).toBeDefined();
360-
const partialLogHandler = beforeCaptureLogCall![1] as (log: Log) => void;
360+
const partialLogHandler = beforeCaptureLogCall[1];
361361

362362
partialLogHandler(mockLog);
363363

@@ -447,7 +447,7 @@ describe('LogEnricher Integration', () => {
447447

448448
const beforeCaptureLogCall = mockOn.mock.calls.find(call => call[0] === 'beforeCaptureLog');
449449
expect(beforeCaptureLogCall).toBeDefined();
450-
logHandler = beforeCaptureLogCall![1] as (log: Log) => void;
450+
logHandler = beforeCaptureLogCall[1];
451451

452452
mockLog = {
453453
message: 'Test log message',

packages/core/test/tracing/addTracingExtensions.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('Tracing extensions', () => {
1515
test('transaction has default op', async () => {
1616
const transaction = startSpanManual({ name: 'parent' }, span => span);
1717

18-
expect(spanToJSON(transaction!)).toEqual(
18+
expect(spanToJSON(transaction)).toEqual(
1919
expect.objectContaining({
2020
op: 'default',
2121
}),
@@ -25,7 +25,7 @@ describe('Tracing extensions', () => {
2525
test('transaction does not overwrite custom op', async () => {
2626
const transaction = startSpanManual({ name: 'parent', op: 'custom' }, span => span);
2727

28-
expect(spanToJSON(transaction!)).toEqual(
28+
expect(spanToJSON(transaction)).toEqual(
2929
expect.objectContaining({
3030
op: 'custom',
3131
}),
@@ -36,7 +36,7 @@ describe('Tracing extensions', () => {
3636
startSpanManual({ name: 'parent', scope: getCurrentScope() }, () => {});
3737
const span = startSpanManual({ name: 'child', scope: getCurrentScope() }, span => span);
3838

39-
expect(spanToJSON(span!)).toEqual(
39+
expect(spanToJSON(span)).toEqual(
4040
expect.objectContaining({
4141
op: 'default',
4242
}),
@@ -47,7 +47,7 @@ describe('Tracing extensions', () => {
4747
startSpanManual({ name: 'parent', op: 'custom', scope: getCurrentScope() }, () => {});
4848
const span = startSpanManual({ name: 'child', op: 'custom', scope: getCurrentScope() }, span => span);
4949

50-
expect(spanToJSON(span!)).toEqual(
50+
expect(spanToJSON(span)).toEqual(
5151
expect.objectContaining({
5252
op: 'custom',
5353
}),
@@ -60,22 +60,22 @@ describe('Tracing extensions', () => {
6060
childSpan = startSpanManual({ name: 'child', scope: getCurrentScope() }, __span => __span);
6161
return _span;
6262
});
63-
childSpan!.end();
64-
transaction!.end();
63+
childSpan.end();
64+
transaction.end();
6565

6666
await client.flush();
6767
expect(client.event).toEqual(
6868
expect.objectContaining({
6969
contexts: expect.objectContaining({
7070
trace: expect.objectContaining({
71-
trace_id: transaction!.spanContext().traceId,
71+
trace_id: transaction.spanContext().traceId,
7272
}),
7373
}),
7474
}),
7575
);
76-
expect(spanToJSON(childSpan!)).toEqual(
76+
expect(spanToJSON(childSpan)).toEqual(
7777
expect.objectContaining({
78-
parent_span_id: spanToJSON(transaction!).span_id,
78+
parent_span_id: spanToJSON(transaction).span_id,
7979
}),
8080
);
8181
});

packages/core/test/tracing/integrations/appStart.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ function expectEventWithStandaloneColdAppStart(
11971197
timestamp: expect.any(Number),
11981198
trace_id: expect.any(String),
11991199
span_id: expect.any(String),
1200-
parent_span_id: actualEvent!.contexts!.trace!.span_id,
1200+
parent_span_id: actualEvent.contexts.trace.span_id,
12011201
origin: SPAN_ORIGIN_AUTO_APP_START,
12021202
status: 'ok',
12031203
data: {
@@ -1248,7 +1248,7 @@ function expectEventWithStandaloneWarmAppStart(
12481248
timestamp: expect.any(Number),
12491249
trace_id: expect.any(String),
12501250
span_id: expect.any(String),
1251-
parent_span_id: actualEvent!.contexts!.trace!.span_id,
1251+
parent_span_id: actualEvent.contexts.trace.span_id,
12521252
origin: SPAN_ORIGIN_AUTO_APP_START,
12531253
status: 'ok',
12541254
data: {

packages/core/test/tracing/integrations/stallTracking/stalltracking.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ describe('StallTracking', () => {
153153
jest.runOnlyPendingTimers();
154154
});
155155
jest.runOnlyPendingTimers();
156-
rootSpan!.end(childSpanEnd);
156+
rootSpan.end(childSpanEnd);
157157

158158
await client.flush();
159159

@@ -169,7 +169,7 @@ describe('StallTracking', () => {
169169
jest.runOnlyPendingTimers();
170170
});
171171
jest.runOnlyPendingTimers();
172-
rootSpan!.end(childSpanEnd! + 20);
172+
rootSpan.end(childSpanEnd! + 20);
173173

174174
await client.flush();
175175

packages/core/test/tracing/integrations/userInteraction.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ describe('User Interaction Tracing', () => {
212212
op: 'different.op',
213213
}),
214214
);
215-
expect(firstTransactionEvent!.timestamp).toBeGreaterThanOrEqual(spanToJSON(secondTransaction!).start_timestamp!);
215+
expect(firstTransactionEvent.timestamp).toBeGreaterThanOrEqual(spanToJSON(secondTransaction).start_timestamp);
216216
});
217217

218218
test('different UI event and same element finish first transaction with last span', () => {
@@ -252,9 +252,9 @@ describe('User Interaction Tracing', () => {
252252

253253
const firstTransactionContext = spanToJSON(firstTransaction!);
254254
const secondTransactionContext = spanToJSON(secondTransaction!);
255-
expect(firstTransactionContext!.timestamp).toEqual(expect.any(Number));
256-
expect(secondTransactionContext!.timestamp).toEqual(expect.any(Number));
257-
expect(firstTransactionContext!.span_id).not.toEqual(secondTransactionContext!.span_id);
255+
expect(firstTransactionContext.timestamp).toEqual(expect.any(Number));
256+
expect(secondTransactionContext.timestamp).toEqual(expect.any(Number));
257+
expect(firstTransactionContext.span_id).not.toEqual(secondTransactionContext.span_id);
258258
});
259259

260260
test('do not start UI event transaction if active transaction on scope', () => {
@@ -297,7 +297,7 @@ describe('User Interaction Tracing', () => {
297297
timestamp: expect.any(Number),
298298
}),
299299
);
300-
expect(interactionTransactionContext!.timestamp).toBeLessThanOrEqual(routingTransactionContext!.start_timestamp!);
300+
expect(interactionTransactionContext.timestamp).toBeLessThanOrEqual(routingTransactionContext.start_timestamp);
301301
});
302302

303303
test('does not start UI span when app is in background', () => {

0 commit comments

Comments
 (0)