You can subscribe to the typescript tag micro-feed.

TypeScript Mixins Part Three

Don’t worry, the mechanism for creating TypeScript Mixins hasn’t changed, but I just wanted to demonstrate that the technique described in TypeScript Mixins Part Two is valid for use with static properties. Reusing the original example, let’s see what happens if we add static properties to our Flies and Climbs mixins. type Constructor<T = {}> […]

This is just a short note on how to use an ECMAScript Proxy to intercept methods. There are plenty of examples that intercept properties, but examples with methods seem absent currently. For demonstration purposes, we’re going to intercept a very famous method. The console log method takes any number of arguments of any type. This […]

Apply TypeScript Types Honestly

TypeScript is optionally statically typed, which means you can still write dynamically typed expressions within your TypeScript programs. If you drop into a block of dynamic code, and then want to come back out into statically typed code – you’ll need to introduce the types, and are responsible for the correctness of the type you […]

Embracing the TypeScript Strict Mode

TypeScript has had the strict compiler option for a while now. It enables several more stringent checks, including two of my favourites: noImplicitAny and strictNullChecks. My summary of strict mode would be this… “If using TypeScript is better than using plain JavaScript because of the compiler warnings, why wouldn’t you want to turn the compiler […]

Deep TypeScript Destructuring

When you first encounter TypeScript (or JavaScript) destructuring it looks a little bit magic, especially in object destructuring where it looks like you are doing everything in a mirror (the names go on the right!). If you find destructuring a little confusing – strap yourselves in and we’ll rush our way to an example of […]