File tree Expand file tree Collapse file tree 1 file changed +0
-23
lines changed Expand file tree Collapse file tree 1 file changed +0
-23
lines changed Original file line number Diff line number Diff line change @@ -144,29 +144,6 @@ src/
144144 validation.ts
145145```
146146
147- ## 6. Consolidate Linting and Formatting at the Root Level
148-
149- Define linting and formatting configurations once at the root level to ensure consistency and simplify maintenance.
150-
151- ## 7. Prefer Compile-Time Validation Over Runtime Checks
152-
153- Leverage compile-time validation by defining robust type systems, rather than relying heavily on runtime checks. Example:
154-
155- ``` typescript
156- type AdminUser = { kind: ' admin' ; id: string ; permissions: string [] };
157- type RegularUser = { kind: ' regular' ; id: string };
158-
159- type User = AdminUser | RegularUser ;
160-
161- function handleUser(user : User ) {
162- if (user .kind === ' admin' ) {
163- // Admin logic
164- } else {
165- // regular user logic
166- }
167- }
168- ```
169-
170147## 7. Type-Driven Development
171148
172149Use comprehensive, precise types to enforce correctness at compile-time rather than relying on runtime validation.
You can’t perform that action at this time.
0 commit comments