In VS Code 's source code, I found a pice of code like this:
(typescript)
/**
* Creates a new object of the provided class and will call the constructor with
* any additional argument supplied.
*/
export function create(ctor: Function, ...args: any[]): any {
let obj = Object.create(ctor.prototype);
ctor.apply(obj, args);
return obj;
}
I think it's same with new ctor(...args)
.
Isn't it?