Skip to content

Commit

Permalink
ref(integrations): Make ReportTypes a const enum (#4209)
Browse files Browse the repository at this point in the history
`ReportTypes` is an interally used enum, so we do not need the runtime support. The `ReportTypes` enum lives in `packages/integrations/src/reportingobserver.ts` and is used by the `ReportingObserver` integration to manage report types.

According to the TS docs: https://www.typescriptlang.org/docs/handbook/enums.html 

> Const enums can only use constant enum expressions and unlike regular enums they are completely removed during compilation. Const enum members are inlined at use sites. This is possible since const enums cannot have computed members. 

This helps save on bundle size.
  • Loading branch information
AbhiPrasad authored Dec 2, 2021
1 parent 91c0909 commit 7ec20cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/integrations/src/reportingobserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface Report {
}

/** JSDoc */
enum ReportTypes {
const enum ReportTypes {
/** JSDoc */
Crash = 'crash',
/** JSDoc */
Expand Down

0 comments on commit 7ec20cb

Please sign in to comment.