Skip to content

Commit 292cab8

Browse files
authored
ref(types): Add undefined as possible event type (#6584)
Setting an `Event`'s property `type: undefined`, like we do in the SDK for `ErrorEvent`s causes a TS error, whenever the recommended `exactOptionalPropertyTypes` TS option is enabled. This option was introduced in TS 4.4. Since we're on TS 3.8, we couldn't catch this error. This patch changes to `EventType` type declaration to also accept `undefined` as a value, thereby resolving the TS error.
1 parent 6e27ce9 commit 292cab8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/types/src/event.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ export interface Event {
5858
};
5959
}
6060

61-
/** JSDoc */
62-
export type EventType = 'transaction' | 'profile';
61+
/**
62+
* The type of an `Event`.
63+
* Note that `ErrorEvent`s do not have a type (hence its undefined),
64+
* while all other events are required to have one.
65+
*/
66+
export type EventType = 'transaction' | 'profile' | undefined;
6367

6468
export interface ErrorEvent extends Event {
6569
type: undefined;

0 commit comments

Comments
 (0)