Using Rest Parameters in TypeScript Functions
In TypeScript, you can use the spread operator (…) as the final parameter of a function. All of the arguments (except the ones that were explicitly declared before the three dots) passed to that function will be taken and placed in an array.
Words may be confusing and non-intuitive. The example below will make things much clearer.
- TypeScript: Function with Optional and Default Parameters
- Express + TypeScript: Extending Request and Response objects
You can also check out our TypeScript category page for the latest tutorials and examples.