A TypeScript Style Guide

published on 2024/10/31
  • Embrace const assertions. ⭣
  • Strive for data immutability (Readonly, ReadonlyArray). ⭣
  • Embrace discriminated unions. ⭣
  • Majority of function arguments should be required (use optional sparingly). ⭣
  • Avoid type assertions. ⭣
  • Strive for functions to be pure, stateless and have single responsibility. ⭣
  • Strong emphasis to keep naming conventions consistent and readable. ⭣
  • Use named exports. ⭣
  • Code is organized and grouped by feature. Collocate code as close as possible to where it's relevant. ⭣

typescript-style-guide