24 lines
No EOL
1 KiB
Text
24 lines
No EOL
1 KiB
Text
tests/cases/compiler/genericConstructorFunction1.ts(4,5): error TS2348: Value of type 'new (arg: T) => Date' is not callable. Did you mean to include 'new'?
|
|
tests/cases/compiler/genericConstructorFunction1.ts(13,13): error TS2348: Value of type 'I1<T>' is not callable. Did you mean to include 'new'?
|
|
|
|
|
|
==== 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);
|
|
~~~~~~~~
|
|
!!! error TS2348: 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);
|
|
~~~~~~~~
|
|
!!! error TS2348: Value of type 'I1<T>' is not callable. Did you mean to include 'new'?
|
|
return new v2(args); // used to give error
|
|
} |