Track
TypeScript
Review type narrowing, API boundaries, unions, and safer function shapes.
- 01
Type inference and explicit boundaries
Let TypeScript infer local values, but type the boundaries other code depends on.
inferenceboundariesapi-design - 02
Narrowing unknown
Check unknown values before using them as trusted application data.
unknownnarrowingruntime-data - 03
Avoiding unsafe assertions
Prefer checks that prove a value's shape over assertions that silence the compiler.
assertionssafetyruntime-data - 04
Discriminated unions
Model related states with a discriminant so callers can narrow safely.
unionsstatenarrowing - 05
Exhaustive checks with never
Make every union case handled so new states fail loudly during development.
unionsexhaustivenever - 06
Precise function types
Describe callbacks with the arguments and return value the caller actually supports.
functionscallbacksapi-design - 07
Optional properties vs nullable values
Use optional and nullable fields to describe different kinds of absence.
optionalnullabledata-modeling - 08
Generic constraints
Constrain generics to the fields the function actually needs.
genericsconstraintsapi-design - 09
Utility types at API boundaries
Derive focused request and view types from domain types without exposing everything.
utility-typesapi-designboundaries - 10
Type-only imports and module boundaries
Separate type dependencies from runtime dependencies so modules stay lightweight.
importsmodulesboundaries