22 lines
507 B
Text
22 lines
507 B
Text
=== tests/cases/compiler/genericTypeWithCallableMembers2.ts ===
|
|
function foo1<T extends { (): string; }>(f: T) {
|
|
>foo1 : <T extends () => string>(f: T) => string
|
|
>T : T
|
|
>f : T
|
|
>T : T
|
|
|
|
return f(); // should return 'string', once returned 'any'
|
|
>f() : string
|
|
>f : T
|
|
}
|
|
|
|
function foo2<T extends { new (): string; }>(f: T) {
|
|
>foo2 : <T extends new () => string>(f: T) => string
|
|
>T : T
|
|
>f : T
|
|
>T : T
|
|
|
|
return new f(); // should be legal, once was an error
|
|
>new f() : string
|
|
>f : T
|
|
}
|