diff --git a/tests/cases/conformance/types/conditional/inferTypes1.ts b/tests/cases/conformance/types/conditional/inferTypes1.ts index 6f31b8e49eb..83d6bd0c0b3 100644 --- a/tests/cases/conformance/types/conditional/inferTypes1.ts +++ b/tests/cases/conformance/types/conditional/inferTypes1.ts @@ -33,6 +33,7 @@ type T15 = ReturnType; // any type T16 = ReturnType; // never type T17 = ReturnType; // Error type T18 = ReturnType; // Error +type T19 = ReturnType<(x: string, ...args: T) => T[]>; // T[] type U10 = InstanceType; // C type U11 = InstanceType; // any @@ -168,3 +169,13 @@ type EnsureIsString = T extends MustBeString ? U : never; type Test1 = EnsureIsString<"hello">; // "hello" type Test2 = EnsureIsString<42>; // never + +// Repros from #26856 + +function invoker (key: K, ...args: A) { + return any>> (obj: T): ReturnType => obj[key](...args) +} + +const result = invoker('test', true)({ test: (a: boolean) => 123 }) + +type Foo2 = ReturnType<(...args: A) => string>;