Skip to main content

Stylistic choices

No classesโ€‹

No reduceโ€‹

info

Sheriff actually allows using reduce for very simple operations like summing up numbers. Complex operations are banned.

No enumsโ€‹

No overloadsโ€‹

  • generics supersedes them. Overloads are a legacy feature that was made available in Typescript before generics were a thing. Overloads are mostly a C#/Angular leftover. Simply put: there are no problems that function overloads solve better than generics
  • overloads clutter the code and make it more verbose and harder to read, which increase the cognitive overload
  • overloads clutter the VScode tooltips
  • overloads force you to write non-standard javascript syntax
  • overloads are a bad practice. The flexibility that they enable also enable your team to write inconsistent code. Which is exactly the problem that ESLint is designed to solve
  • Effective Typescript book explicitly warn against this, saying that "conditional types" are preferrable.