Nov 15, 2012 at 10:13 PM
Edited Nov 15, 2012 at 10:15 PM
|
Is there a correct syntax to specify a return type for a ctor?
In this simple example I can't seem to get that working:
class Test {
constructor(): string {
}
}
Gives a compiler error, Expected "{"
And
class Test {
constructor() => Test {
}
}
Causes the playground to throw errors:
SKIPPING refresh because models are weird editor.main.js:10
Object {message: "RangeError: Maximum call stack size exceeded"} editor.main.js:10
Interfaces are allowed to define a constructor with a return type:
interface MyInterface {
new () : any;
}
How would you implement this interface correctly?
|