Skip to content

Commit e50a43f

Browse files
committed
ref(utils): Make States a const enum (#4210)
`States` is an interally used enum, so we do not need the runtime support. The `States` enum lives in `packages/utils/src/syncpromise.ts` and is used by `SyncPromise` to manage state internally. 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.
1 parent 751e054 commit e50a43f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/utils/src/syncpromise.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import { isThenable } from './is';
66

77
/** SyncPromise internal states */
8-
enum States {
8+
const enum States {
99
/** Pending */
1010
PENDING = 'PENDING',
1111
/** Resolved / OK */

0 commit comments

Comments
 (0)