You can subscribe to the typescript tag micro-feed.

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 […]

TypeScript Pixel Counter

In the process of writing an article on Pie Charts, I was faced with a situation where I needed to programmatically count the pixels on the pie chart in order to reverse-engineer the original values. To do this, I wrote a quick utility in TypeScript to do the following: Load an image Read each pixel […]