TypeScript/tests/baselines/reference/genericConstructorFunction1.errors.txt
2014-07-12 17:30:19 -07:00

20 lines
731 B
Plaintext

==== tests/cases/compiler/genericConstructorFunction1.ts (2 errors) ====
function f1<T>(args: T) {
var v1: { [index: string]: new (arg: T) => Date };
var v2 = v1['test'];
v2(args);
~~~~~~~~
!!! Value of type 'new (arg: T) => Date' is not callable. Did you mean to include 'new'?
return new v2(args); // used to give error
}
interface I1<T> { new (arg: T): Date };
function f2<T>(args: T) {
var v1: { [index: string]: I1<T> };
var v2 = v1['test'];
var y = v2(args);
~~~~~~~~
!!! Value of type 'I1<T>' is not callable. Did you mean to include 'new'?
return new v2(args); // used to give error
}