I\'ve come across the following type annotation on a function parameter:
typeFilter : new(...args) => T
where T
is a generi
TL;DR new(...args) => T
represents constructor of T
taking any parameters.
new
describes "static" part of a class/function, meaning it is a constructor and consumer can create new instance of T
using new
keyword. Example here.
As for ...args
- these are rest parameters
Rest parameters are treated as a boundless number of optional parameters. When passing arguments for a rest parameter, you can use as many as you want; you can even pass none