Dev Helpers
← Back

Type a function argument list

Type a function argument list using TypeScript.

Open this example in the interactive library

Source code

type Point = readonly [x: number, y: number];
const point: Point = [3, 4];
console.log(
  ((...args: Parameters<typeof Math.hypot>) => Math.hypot(...args))(6, 8),
);

Sample output

10