Statically Typing Complexity with TypeScript

Statically Typing Complexity with TypeScript

5 years ago
Anonymous $L9wC17otzH

https://medium.com/@cdebotton/statically-typing-complexity-with-typescript-8a0bdb5f135f

There’s going to be a brief (I promise) wall of text before we get into some code, so entice you into continuing, here’s a video of what we’re building. A type safe implementation at a key access level for several methods that get, set, and update values in deeply nested, complex objects and arrays.

In this article I would like to discuss how to statically type and write a set of complex functions that provide an API with absolute type safety. Through this exercise, my goal is to highlight the strengths and weaknesses of TypeScript as a type system. I may have been in the minority leading up to this point, but I’ve been eagerly looking forward to statically typed JavaScript for a very long time. My first real experience with types and programming behind high school Java and C classes was pretty late. I spent a year writing Swift while building a native iPad application. It definitely changed how I thought about programming and shifted my mental model from scrambling to get things to work toward designing well thought out systems which worked because of a guarantee from the compiler.