TypeScript/tests/cases/compiler/genericTypeWithCallableMembers2.ts
2014-07-12 17:30:19 -07:00

7 lines
234 B
TypeScript

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
}