TypeScript/tests/cases/compiler/genericTypeWithCallableMembers2.ts

7 lines
234 B
TypeScript
Raw Normal View History

2014-07-13 01:04:16 +02:00
function foo1<T extends { (): string; }>(f: T) {
return f(); // should return 'string', once returned 'any'
}
function foo2<T extends { new (): string; }>(f: T) {
return new f(); // should be legal, once was an error
}