Comment

Comment by maxbendick

Something I love about advanced TypeScript types: they're easy to consume given some documentation, even when the programmer doesn't understand them. Defining the types is another story.

Editors give great autocomplete suggestions (usually covers it for properties and return values). Documenting with examples is often helpful. If all else fails, cast.

Without advanced types, code needs documentation to prevent invalidity. With advanced types, code gets logical guarantees, but it often requires the same documentation. It's not necessary for everyone on a team to have cutting edge knowledge when there's sensible documentation.

Types create a synergy with documentation. Provable(ish) guarantees with good documentation is the best of both worlds.

parent maxbendick 6 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton