Steve Fenton


You can subscribe to the typescript tag micro-feed.

TypeScript NotFunction Type

I have been working out how to create a TypeScript NotFunction type for a while, in response to a Stack Overflow question. With the arrival of conditional types, I think there may be a way. It’s not perfect – but it does work. The type works by taking all possible types and converting the type […]

C# Interfaces: Default Implementations

The C# 8.0 announcement included a note on default implementations of interface members. If you’ve been programming for long enough, this might make you a little nervous at first thanks to the hangovers of multiple inheritance. Before you chuck out this idea, though, let’s look at it from a different perspective. I’m going to talk […]

TypeScript Dictarray Options

This is one of those cases where a question keeps cropping up, so lots of people are trying to do something that the TypeScript Compiler doesn’t like very much. Yes, it’s time to talk about the TypeScript Dictarray! What’s a Dictarrary? It’s a dictionary that’s also an array. You know… one of these: const dictarray […]

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. Not only does this […]

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