Open this example in the interactive library
Source code
type Point = readonly [x: number, y: number];
const a: Point = [3, 4],
b: Point = [7, 1];
console.log((([x, y]: Point): Point => [-x, y])(a));
Sample output
[ -3, 4 ]

Reflect a coordinate across the vertical axis using TypeScript.
Open this example in the interactive library
type Point = readonly [x: number, y: number];
const a: Point = [3, 4],
b: Point = [7, 1];
console.log((([x, y]: Point): Point => [-x, y])(a));
[ -3, 4 ]