Accept new baselines

This commit is contained in:
Anders Hejlsberg 2016-12-04 07:50:10 -08:00
parent 95aed3f4ee
commit ee172cfa39
3 changed files with 70 additions and 0 deletions

View file

@ -353,6 +353,17 @@ interface Options2<Data, Computed> {
declare class Component2<Data, Computed> {
constructor(options: Options2<Data, Computed>);
get<K extends keyof Data | keyof Computed>(key: K): (Data & Computed)[K];
}
// Repro from #12641
interface R {
p: number;
}
function f<K extends keyof R>(p: K) {
let a: any;
a[p].add; // any
}
//// [keyofAndIndexedAccess.js]
@ -589,6 +600,10 @@ var c1 = new Component1({
}
});
c1.get("hello");
function f(p) {
var a;
a[p].add; // any
}
//// [keyofAndIndexedAccess.d.ts]
@ -757,3 +772,7 @@ declare class Component2<Data, Computed> {
constructor(options: Options2<Data, Computed>);
get<K extends keyof Data | keyof Computed>(key: K): (Data & Computed)[K];
}
interface R {
p: number;
}
declare function f<K extends keyof R>(p: K): void;

View file

@ -1320,3 +1320,27 @@ declare class Component2<Data, Computed> {
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 351, 30))
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 353, 8))
}
// Repro from #12641
interface R {
>R : Symbol(R, Decl(keyofAndIndexedAccess.ts, 354, 1))
p: number;
>p : Symbol(R.p, Decl(keyofAndIndexedAccess.ts, 358, 13))
}
function f<K extends keyof R>(p: K) {
>f : Symbol(f, Decl(keyofAndIndexedAccess.ts, 360, 1))
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 362, 11))
>R : Symbol(R, Decl(keyofAndIndexedAccess.ts, 354, 1))
>p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 362, 30))
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 362, 11))
let a: any;
>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 363, 7))
a[p].add; // any
>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 363, 7))
>p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 362, 30))
}

View file

@ -1560,3 +1560,30 @@ declare class Component2<Data, Computed> {
>Computed : Computed
>K : K
}
// Repro from #12641
interface R {
>R : R
p: number;
>p : number
}
function f<K extends keyof R>(p: K) {
>f : <K extends "p">(p: K) => void
>K : K
>R : R
>p : K
>K : K
let a: any;
>a : any
a[p].add; // any
>a[p].add : any
>a[p] : any
>a : any
>p : K
>add : any
}