You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currenlty, TS enum is used across the codebase. I would be good to be replaced with the companion pattern approach to increase the type safety.
To have better understanding, here's a good thread why it would be good to avoid enums in TS Don't use Enums in Typescript, they are very dangerous
exportconstNetworkName={SN_MAIN: 'SN_MAIN',SN_GOERLI: 'SN_GOERLI',SN_SEPOLIA: 'SN_SEPOLIA',}asconst;// eslint-disable-next-line @typescript-eslint/no-redeclare -- intentionally naming the variable the same as the typeexporttypeNetworkName=(typeofNetworkName)[keyoftypeofNetworkName];
Describe alternatives you've considered
Pros:
Increased type safety
Less prone to mistakes and errors (especially for numerics)
Decreased output size and improved performance
Cons:
Eslint re-declare rule does not have exception for declaring the same name type and variable. Either, the rule should be disabled or we'll add eslint ignore for these cases which will be annoying
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered:
@kateberryd sorry, Luka reached out earlier to solve this (when he opened the issue), but I forgot to assign him...
Keep an eye on other issues, there will soon be more!
Is your feature request related to a problem? Please describe.
Currenlty, TS
enum
is used across the codebase. I would be good to be replaced with thecompanion pattern
approach to increase the type safety.To have better understanding, here's a good thread why it would be good to avoid enums in TS
Don't use Enums in Typescript, they are very dangerous
Describe the solution you'd like
BEFORE
AFTER
Describe alternatives you've considered
Pros:
Cons:
re-declare
rule does not have exception for declaring the same name type and variable. Either, the rule should be disabled or we'll add eslint ignore for these cases which will be annoyingAdditional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: