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

Replace TS enums by plain objects #41

Closed
arobsn opened this issue Sep 6, 2023 · 1 comment
Closed

Replace TS enums by plain objects #41

arobsn opened this issue Sep 6, 2023 · 1 comment
Milestone

Comments

@arobsn
Copy link
Member

arobsn commented Sep 6, 2023

TypeScript Enums are bad, consider replacing them by plain objects for improved compatibility and efficiency.

Plain object enum example:

export const ergoTreeHeaderFlags = {
  sizeInclusion: 0x08,
  constantSegregation: 0x10
} as const;

export type ErgoTreeHeaderFlag = (typeof ergoTreeHeaderFlags)[keyof typeof ergoTreeHeaderFlags];
@arobsn arobsn added this to the v1.0 milestone Sep 6, 2023
@arobsn
Copy link
Member Author

arobsn commented Jun 27, 2024

Enum Objects don't offer a good DX, since DX is a Fleet's focus, tradeoffs are acceptable

@arobsn arobsn closed this as completed Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant