Skip to content

Commit bead28c

Browse files
authored
fix(types): Make name required on transaction class (#2949)
This allows the class to implement the interface, where `name` has always been required.
1 parent e39c754 commit bead28c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

packages/tracing/src/transaction.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { getCurrentHub, Hub } from '@sentry/hub';
2-
import { TransactionContext } from '@sentry/types';
2+
import { Transaction as TransactionInterface, TransactionContext } from '@sentry/types';
33
import { isInstanceOf, logger } from '@sentry/utils';
44

55
import { Span as SpanClass, SpanRecorder } from './span';
66

77
/** JSDoc */
8-
export class Transaction extends SpanClass {
9-
public name?: string;
8+
export class Transaction extends SpanClass implements TransactionInterface {
9+
public name: string;
1010

1111
/**
1212
* The reference to the current hub.
@@ -29,9 +29,7 @@ export class Transaction extends SpanClass {
2929
this._hub = hub as Hub;
3030
}
3131

32-
if (transactionContext.name) {
33-
this.name = transactionContext.name;
34-
}
32+
this.name = transactionContext.name ? transactionContext.name : '';
3533

3634
this._trimEnd = transactionContext.trimEnd;
3735
}

0 commit comments

Comments
 (0)