File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -75,14 +75,14 @@ Being expressive and keeping types as **narrow as possible** offers several bene
7575
7676### Type Inference
7777
78- As a rule of thumb, explicitly declare types when it helps to narrow them.
78+ As a rule of thumb, explicitly declare types only when it helps to narrow them.
7979
8080<Note >
8181 Just because you don't need to add types doesn't mean you shouldn't. In some cases, explicitly declaring types can
8282 improve code readability and clarify intent.
8383</Note >
8484
85- Explicitly declare types when it helps to narrow them:
85+ Explicitly declare types when doing so helps to narrow them:
8686
8787``` ts
8888// ❌ Avoid
@@ -98,7 +98,7 @@ type UserRole = 'admin' | 'guest';
9898const [userRole, setUserRole] = useState <UserRole >(' admin' ); // Explicit type 'UserRole'
9999```
100100
101- Don't explicitly declare types when they can be inferred:
101+ Avoid explicitly declaring types when they can be inferred:
102102
103103``` ts
104104// ❌ Avoid
You can’t perform that action at this time.
0 commit comments