RecipesChapter 7: Variadic Tuple Types

Typing a concat Function

Recipe 7.1 from The TypeScript Cookbook

declare const a: string[]
declare const b: number[]

// const test: (string | number)[]
const test = concat(a, b);
Open in TypeScript Playground →