@@ -53,15 +53,15 @@ Style Guide assumes using, but is not limited to:
5353
5454## TLDR
5555
56- - Embrace const assertions. [ ⭣ ; ] ( #const-assertion )
57- - Strive for data immutability using types like ` Readonly ` and ` ReadonlyArray ` . [ ⭣ ; ] ( #data-immutability )
58- - Majority of object properties should be required (use optional sparingly). [ ⭣ ; ] ( #required--optional-object-properties )
59- - Embrace discriminated unions. [ ⭣ ; ] ( #discriminated-union )
60- - Avoid type assertions. [ ⭣ ; ] ( #type--non-nullability-assertions )
61- - Strive for functions to be pure, stateless and have single responsibility. [ ⭣ ; ] ( #functions )
62- - Strong emphasis to keep naming conventions consistent and readable. [ ⭣ ; ] ( #naming-conventions )
63- - Use named exports. [ ⭣ ; ] ( #named-export )
64- - Code is organized and grouped by feature. Collocate code as close as possible to where it's relevant. [ ⭣ ; ] ( #code-collocation )
56+ - ** Embrace const assertions** . [ ⭣ ; ] ( #const-assertion )
57+ - Strive for ** data immutability** using types like ` Readonly ` and ` ReadonlyArray ` . [ ⭣ ; ] ( #data-immutability )
58+ - Majority of ** object properties** should be ** required** (use optional sparingly). [ ⭣ ; ] ( #required--optional-object-properties )
59+ - ** Embrace discriminated unions** . [ ⭣ ; ] ( #discriminated-union )
60+ - ** Avoid type assertions** . [ ⭣ ; ] ( #type--non-nullability-assertions )
61+ - Strive for functions to be ** pure** , ** stateless** and have ** single responsibility** . [ ⭣ ; ] ( #functions )
62+ - Strong emphasis to keep ** naming conventions consistent and readable** . [ ⭣ ; ] ( #naming-conventions )
63+ - Use ** named exports** . [ ⭣ ; ] ( #named-export )
64+ - Code is ** organized** and ** grouped by feature** . Collocate code as close as possible to where it's relevant. [ ⭣ ; ] ( #code-collocation )
6565
6666## Types
6767
@@ -93,7 +93,6 @@ const USER_ROLE = 'admin'; // Type 'admin'
9393const employees = new Map ([[' Gabriel' , 32 ]]); // Type 'Map<string, number>'
9494const [isActive, setIsActive] = useState (false ); // Type 'boolean'
9595
96-
9796// ❌ Avoid - Don't infer a (wide) type, it can be narrowed.
9897const employees = new Map (); // Type 'Map<any, any>'
9998employees .set (' Lea' , 17 );
@@ -514,8 +513,6 @@ Strive to use const assertion `as const`:
514513 const RATE_LIMIT = 25 ;
515514 const RATE_LIMIT_MESSAGE = ` Max number of requests/min is ${RATE_LIMIT }. ` ; // Type string
516515
517-
518-
519516 // ✅ Use const assertion
520517 const FOO_LOCATION = { x: 50 , y: 130 } as const ; // Type '{ readonly x: 50; readonly y: 130; }'
521518 FOO_LOCATION .x = 10 ; // Error
0 commit comments