Skip to content
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

remove all enums #2654

Open
ryanleecode opened this issue Sep 3, 2024 · 1 comment
Open

remove all enums #2654

ryanleecode opened this issue Sep 3, 2024 · 1 comment
Labels
feature Issues that represent new features or improvements to existing features. t-tooling Issues with this label are in the ownership of the tooling team.

Comments

@ryanleecode
Copy link

ryanleecode commented Sep 3, 2024

Which package is the feature request for? If unsure which one to select, leave blank

None

Feature

remove all enums and convert them into const syntax.

Motivation

Enums, especially ambient enums do not work well with isolated modules turned on.

https://stackoverflow.com/questions/56854964/why-is-const-enum-allowed-with-isolatedmodules

Ideal solution or implementation, and any additional constraints

Every enum would be converted similar to below

-export const enum EventType {
-    PERSIST_STATE = "persistState",
-    SYSTEM_INFO = "systemInfo",
-    MIGRATING = "migrating",
-    ABORTING = "aborting",
-    EXIT = "exit"
-}
-export type EventTypeName = EventType | 'systemInfo' | 'persistState' | 'migrating' | 'aborting' | 'exit';
+
+export const EventType = {
+    readonly PERSIST_STATE: "persistState",
+    readonly SYSTEM_INFO: "systemInfo",
+    readonly MIGRATING: "migrating",
+    readonly ABORTING: "aborting",
+    readonly EXIT: "exit",
+} as const
+
+export type EventTypeName = typeof EventType[keyof typeof EventType]
+

Alternative solutions or implementations

No response

Other context

No response

@ryanleecode ryanleecode added the feature Issues that represent new features or improvements to existing features. label Sep 3, 2024
@github-actions github-actions bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Sep 3, 2024
@vladfrangu
Copy link
Member

We don't have to remove enums, just drop the const from them, and they will work in isolatedModules!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Issues that represent new features or improvements to existing features. t-tooling Issues with this label are in the ownership of the tooling team.
Projects
None yet
Development

No branches or pull requests

2 participants