-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ref(utils): Make States a const enum #4210
Conversation
`States` is an interally used enum, so we do not need the runtime support. This helps save on bundle size.
size-limit report
|
Suggestion: ...so we don't need its underlying values to be meaningful at runtime. Making it a You also might consider mentioning, in the title and/or the description, that |
Updated description |
`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.
`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.
States
is an interally used enum, so we do not need the runtime support. TheStates
enum lives inpackages/utils/src/syncpromise.ts
and is used bySyncPromise
to manage state internally.According to the TS docs: https://www.typescriptlang.org/docs/handbook/enums.html
This helps save on bundle size.