Infer between generic mapped types before inferring from apparent type (#56640)

This commit is contained in:
Gabriela Araujo Britto
2024-01-02 15:35:10 -08:00
committed by GitHub
parent 9e0e9d35b9
commit be20dbbbbb
8 changed files with 216 additions and 7 deletions

View File

@@ -0,0 +1,13 @@
// @strict: true
// @noEmit: true
type Obj = {
[s: string]: number;
};
type foo = <T>(target: { [K in keyof T]: T[K] }) => void;
type bar = <U extends string[]>(source: { [K in keyof U]: Obj[K] }) => void;
declare let f: foo;
declare let b: bar;
b = f;

View File

@@ -0,0 +1,13 @@
// @strict: true
// @noEmit: true
// #56133
declare class Base<T> {
someProp: T;
method<U extends unknown[]>(x: { [K in keyof U]: U[K] }): Base<U>;
}
declare class Derived<T> extends Base<T> {
method<V extends unknown[]>(x: { [K in keyof V]: V[K] }): Base<V>;
}