haspar.us

Power of Preconditions

Oct 30, 2019 · WrocTypeScript

Slides: https://github.com/hasparus/power-of-preconditions


Pitch

TypeScript 3.7 brings us an amazing tool to concisely write preconditions that can’t be described in a function signature. With assertion signatures we can get rid of these ugly if (not cool) throw new Error("totally not cool") blocks.

We’re gonna talk about partial and total functions, returning vs throwing errors and I’ll show you how assertion signatures make my React code safer.