1. React
  2. ReactEurope
  3. 2018
  4. The fun of runtime type systems (Or: "Funtime type systems")

The fun of runtime type systems (Or: "Funtime type systems")

Michel Weststrate at ReactEurope 2018

The React prop-types package is a simple runtime type system that is used for property validation. But runtime type systems can do many more things than just data validation. Because they are very flexible (as you can basically reuse the entire hosting language to express your types) it will be much less likely that you will run into structures that cannot be expressed in the type system. You can generate runtime types on the fly from other sources (json-schema, graphql etc) or compose them together. In this talk I will walk you through some runtime type systems, like prop-types, tcomb and mobx-state-tree. But also show you how runtime- and compile-time type systems like TypeScript or Flow can co-exist and leverage each other. If you thought so far Higher Order Components or render callbacks where cool, in this talk I will show you that these patterns can be applied in general to any data structure you have.