In celebration of TypeScript 4.2’s recent release and the language’s continued evolution, let’s take a look at tuple types and some advanced type manipulations we can do with them.
A Tuple (rhymes with ‘couple’, not ‘pupil’) is a simple container of data. A tuple object has a fixed size, and the type of each element is known but the types don’t need to be the same.
A basic tuple definition is:
This movie tuple has exactly 3 elements and they must be
Date in that order. These structures can be easily destructed into their component parts:
In this tutorial we continue the step by step guide for creating a weather app using React and TypeScript.
Welcome back to this tutorial on using React and TypeScript to build client-side web apps. In Part 1 we covered:
In this post we will complete the tutorial by:
You can find the code on GitHub.
To get real weather data we will need to talk to a service. For this tutorial we’ll use the Open Weather service. The…
In this tutorial I’ll provide a complete introduction to using React and TypeScript to build a client-side web app. Together we’ll create a simple Weather App that allows you to search for locations and displays its current weather and 24 hour forecast.
Along the way, you’ll learn:
You can find the code here on GitHub. The tutorial is broken up into 6 steps spread over 2 blog posts and the code repository contains the end result of each step in…
A look at how both statically and dynamically typed languages have pros and cons and how we should identify the benefits and choose languages that provide the best of both worlds.
Internally as well we have good debates over the relative merits of dynamic vs static languages. My colleague Ryan Adams made great points about choosing good software development practices over relying on static typing and showed…
In this article I’ll take a look at some new features in TypeScript 4.1 — namely Template Literal Types, Key Remapping and Recursive Conditional Types. At the end I’ll show some crazy examples of using these features to do a bit of meta-programming.
I’ve always loved TypeScript and the language just keeps getting better with each evolution. 4.1 has lots of interesting new features. Here I’m going to look at:
TypeScript has supported string literals types since 1.8.
type Beatles = "John" | "Paul" | "George" | "Ringo"
15 years working as a developer. For the last 4 years I've been working as a full time trainer and coach, authoring and delivering courses on a range of topics.