Comment by etler

2 years ago

I find that areas that are hard to type are a code smell indicating potentially unstable API design. It can be pretty tricky adding types to a JavaScript project as the lack of types can lead to some very side effecty apis that can be very difficult or impossible to add full type safety to.

My impression is that people running into these problems are trying to add declaration files to JavaScript code, but if you use typescript throughout I've not run into these problems.

Anything I find hard to type is simply a hard problem to solve in the first place and the type system helps me rethink the problem to find safer and more elegant API designs.