File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -750,10 +750,10 @@ Examples:
750
750
751
751
` ` ` tsx
752
752
// ❌ Avoid using enums
753
- enum UserRole {
754
- GUEST = ' guest' ,
755
- MODERATOR = ' moderator' ,
756
- ADMINISTRATOR = ' administrator' ,
753
+ enum USER_ROLES {
754
+ guest = ' guest' ,
755
+ moderator = ' moderator' ,
756
+ administrator = ' administrator' ,
757
757
}
758
758
759
759
// ✅ Use const assertions arrays
@@ -783,26 +783,26 @@ Examples:
783
783
784
784
` ` ` ts
785
785
// ❌ Avoid using enums
786
- enum Color {
787
- PRIMARY = ' #B33930' ,
788
- SECONDARY = ' #113A5C' ,
789
- BRAND = ' #9C0E7D' ,
786
+ enum COLORS {
787
+ primary = ' #B33930' ,
788
+ secondary = ' #113A5C' ,
789
+ brand = ' #9C0E7D' ,
790
790
}
791
791
792
792
// ✅ Use const assertions objects
793
- const COLOR = {
793
+ const COLORS = {
794
794
primary: ' #B33930' ,
795
795
secondary: ' #113A5C' ,
796
796
brand: ' #9C0E7D' ,
797
797
} as const ;
798
798
799
- type Color = typeof COLOR ;
800
- type ColorKey = keyof Color ; // Type "primary" | "secondary" | "brand"
801
- type ColorValue = Color [ColorKey ]; // Type "#B33930" | "#113A5C" | "#9C0E7D"
799
+ type Colors = typeof COLORS ;
800
+ type ColorKey = keyof Colors ; // Type "primary" | "secondary" | "brand"
801
+ type ColorValue = Colors [ColorKey ]; // Type "#B33930" | "#113A5C" | "#9C0E7D"
802
802
803
803
const setColor = (color : ColorValue ) => {...
804
804
805
- setColor (COLOR .primary );
805
+ setColor (COLORS .primary );
806
806
setColor (' #B33930' );
807
807
` ` `
808
808
You can’t perform that action at this time.
0 commit comments