Accept new baselines

This commit is contained in:
Anders Hejlsberg 2019-07-28 09:06:04 -07:00
parent a717d3ab44
commit 4a17581f67
3 changed files with 64 additions and 0 deletions

View file

@ -172,6 +172,16 @@ class Interesting {
declare function invoke<T>(f: () => T): T;
let xx: 0 | 1 | 2 = invoke(() => 1);
// Repro from #32416
declare function assignPartial<T>(target: T, partial: Partial<T>): T;
let obj = {
foo(bar: string) {}
}
assignPartial(obj, { foo(...args) {} }); // args has type [string]
//// [instantiateContextualTypes.js]
@ -222,3 +232,7 @@ class Interesting {
}
}
let xx = invoke(() => 1);
let obj = {
foo(bar) { }
};
assignPartial(obj, { foo(...args) { } }); // args has type [string]

View file

@ -481,3 +481,29 @@ let xx: 0 | 1 | 2 = invoke(() => 1);
>xx : Symbol(xx, Decl(instantiateContextualTypes.ts, 172, 3))
>invoke : Symbol(invoke, Decl(instantiateContextualTypes.ts, 166, 1))
// Repro from #32416
declare function assignPartial<T>(target: T, partial: Partial<T>): T;
>assignPartial : Symbol(assignPartial, Decl(instantiateContextualTypes.ts, 172, 36))
>T : Symbol(T, Decl(instantiateContextualTypes.ts, 176, 31))
>target : Symbol(target, Decl(instantiateContextualTypes.ts, 176, 34))
>T : Symbol(T, Decl(instantiateContextualTypes.ts, 176, 31))
>partial : Symbol(partial, Decl(instantiateContextualTypes.ts, 176, 44))
>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --))
>T : Symbol(T, Decl(instantiateContextualTypes.ts, 176, 31))
>T : Symbol(T, Decl(instantiateContextualTypes.ts, 176, 31))
let obj = {
>obj : Symbol(obj, Decl(instantiateContextualTypes.ts, 178, 3))
foo(bar: string) {}
>foo : Symbol(foo, Decl(instantiateContextualTypes.ts, 178, 11))
>bar : Symbol(bar, Decl(instantiateContextualTypes.ts, 179, 6))
}
assignPartial(obj, { foo(...args) {} }); // args has type [string]
>assignPartial : Symbol(assignPartial, Decl(instantiateContextualTypes.ts, 172, 36))
>obj : Symbol(obj, Decl(instantiateContextualTypes.ts, 178, 3))
>foo : Symbol(foo, Decl(instantiateContextualTypes.ts, 182, 20))
>args : Symbol(args, Decl(instantiateContextualTypes.ts, 182, 25))

View file

@ -422,3 +422,27 @@ let xx: 0 | 1 | 2 = invoke(() => 1);
>() => 1 : () => 1
>1 : 1
// Repro from #32416
declare function assignPartial<T>(target: T, partial: Partial<T>): T;
>assignPartial : <T>(target: T, partial: Partial<T>) => T
>target : T
>partial : Partial<T>
let obj = {
>obj : { foo(bar: string): void; }
>{ foo(bar: string) {}} : { foo(bar: string): void; }
foo(bar: string) {}
>foo : (bar: string) => void
>bar : string
}
assignPartial(obj, { foo(...args) {} }); // args has type [string]
>assignPartial(obj, { foo(...args) {} }) : { foo(bar: string): void; }
>assignPartial : <T>(target: T, partial: Partial<T>) => T
>obj : { foo(bar: string): void; }
>{ foo(...args) {} } : { foo(bar: string): void; }
>foo : (bar: string) => void
>args : [string]