paulgray.net

Posts about typescript:

Typing HoCs
July 13, 2018
The process of writing a type signature for a HoC can be daunting at first. In this post, I’ll build an HoC and detail the process of writing a type signature for it. The HoC we’ll develop will be simple; it’ll take a promise, and handle the state-management, providing the inner component with the value, and whether it is loading...
Types as a convenience, Assumptions.
December 16, 2016
Minimize your assumptions with types. As developers, we make assumptions every day when we write code. I assume that a method in that library that I’m using didn’t change when I bumped the dependency’s patch version. I assume that the data I get back from /api/users is an object, not an array. I assumed that my wife wanted an honest opinion when she asked...
Types as a convenience, Inference.
December 16, 2016
Type-safe doesn’t mean verbose. A common criticism of typed languages is that they are unnecessarily verbose. While that idea may have some merit with languages like Java, features in newer typed languages have come a long way. The Typescript compiler uses a method known as type inference to make type-safe code less cluttered. Type inference occurs when the compiler can determine a...
Types as a convenience, Intro.
November 04, 2016
Bringing types to your UI. As a developer with experience in both type safe and weakly typed languages, I much prefer the former, simply because I enjoy it more. In a series of following blog posts, I’ll attempt to make an argument for types, and make some recommendations of where I think they bring the most benefit. If you’re already sold on...