This specific code snippet functions properly in the TypeScript Playground...
class Foo {
constructor(...args: any[]) {
}
static make(...args: any[]): Foo {
return new Foo(...args);
}
}
However, when trying to incorporate it into a TypeScript project in Visual Studio, it encounters issues. The error prompted for args
within the line return new Foo(...args);
is:
Type must have a 'Symbol.iterator' method that returns an iterator.
What could be causing this discrepancy?
The local machine is using TypeScript version 2.7. The issue arises once the build target is switched to es2018