Reflection across the vertical axis changes the horizontal sign and leaves the vertical coordinate in place. Return a new point when callers retain the original.
Worked example
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));Result
[ -3, 4 ]Implementation notes
Floating-point coordinates can accumulate small rounding errors after repeated transformations. Test numerical behaviour separately from type correctness.
Try it yourself
Reflect a point on the axis and then reflect an off-axis point twice.
Open the TypeScript example →Editorial date November 20, 2026 · Published December 6, 2026