20 lines
965 B
Text
20 lines
965 B
Text
=== tests/cases/compiler/genericTypeWithCallableMembers2.ts ===
|
|
function foo1<T extends { (): string; }>(f: T) {
|
|
>foo1 : Symbol(foo1, Decl(genericTypeWithCallableMembers2.ts, 0, 0))
|
|
>T : Symbol(T, Decl(genericTypeWithCallableMembers2.ts, 0, 14))
|
|
>f : Symbol(f, Decl(genericTypeWithCallableMembers2.ts, 0, 41))
|
|
>T : Symbol(T, Decl(genericTypeWithCallableMembers2.ts, 0, 14))
|
|
|
|
return f(); // should return 'string', once returned 'any'
|
|
>f : Symbol(f, Decl(genericTypeWithCallableMembers2.ts, 0, 41))
|
|
}
|
|
|
|
function foo2<T extends { new (): string; }>(f: T) {
|
|
>foo2 : Symbol(foo2, Decl(genericTypeWithCallableMembers2.ts, 2, 1))
|
|
>T : Symbol(T, Decl(genericTypeWithCallableMembers2.ts, 4, 14))
|
|
>f : Symbol(f, Decl(genericTypeWithCallableMembers2.ts, 4, 45))
|
|
>T : Symbol(T, Decl(genericTypeWithCallableMembers2.ts, 4, 14))
|
|
|
|
return new f(); // should be legal, once was an error
|
|
>f : Symbol(f, Decl(genericTypeWithCallableMembers2.ts, 4, 45))
|
|
}
|