RecipesChapter 2: Basic Types

Working with Tuple Types

Recipe 2.3 from The TypeScript Cookbook

const person: [string, number] = ["Stefan", 40];

function hello(...args: [name: string, msg: string]): {
 // ...
}

hello(...person);
Open in TypeScript Playground →