7 things I search for when I audit a TypeScript codebase: any - Use a...
7 things I search for when I audit a TypeScript codebase:
any - Use a narrower type.
?. - Avoid by narrowing type.
?: - Optional properties are often overused/misused. Can often eliminate via a discriminated union.
string | number - Codebases often needlessly switch between number and string. Pick one. Narrow if possible.
= 0 - Zero is often misused to represent the explicit lack of a number instead of null.
let - Often a sign of needlessly complex mutative code.
as - Avoid type assertions. Not type safe. Zod often helps here.
Of course, this is far from an exhaustive list.
Interested in an audit? Ping me.