Open this example in the interactive library
Source code
type Point = readonly [x: number, y: number];
const point: Point = [3, 4];
console.log(
(<T extends readonly unknown[], U>(t: T, u: U): [...T, U] => [...t, u])(
point,
"end",
),
);
Sample output
[ 3, 4, 'end' ]
