Accept new baselines

This commit is contained in:
Anders Hejlsberg 2018-12-20 07:21:56 -08:00
parent 3e93461fc8
commit 017c11acaa
4 changed files with 183 additions and 0 deletions

View File

@ -106,4 +106,26 @@ tests/cases/compiler/discriminantPropertyCheck.ts(65,9): error TS2532: Object is
}
}
}
// Repro from #29106
const f = (_a: string, _b: string): void => {};
interface A {
a?: string;
b?: string;
}
interface B {
a: string;
b: string;
}
type U = A | B;
const u: U = {} as any;
u.a && u.b && f(u.a, u.b);
u.b && u.a && f(u.a, u.b);

View File

@ -98,6 +98,28 @@ function func2(inst: Instance) {
}
}
}
// Repro from #29106
const f = (_a: string, _b: string): void => {};
interface A {
a?: string;
b?: string;
}
interface B {
a: string;
b: string;
}
type U = A | B;
const u: U = {} as any;
u.a && u.b && f(u.a, u.b);
u.b && u.a && f(u.a, u.b);
//// [discriminantPropertyCheck.js]
@ -161,3 +183,8 @@ function func2(inst) {
}
}
}
// Repro from #29106
var f = function (_a, _b) { };
var u = {};
u.a && u.b && f(u.a, u.b);
u.b && u.a && f(u.a, u.b);

View File

@ -311,3 +311,69 @@ function func2(inst: Instance) {
}
}
// Repro from #29106
const f = (_a: string, _b: string): void => {};
>f : Symbol(f, Decl(discriminantPropertyCheck.ts, 102, 5))
>_a : Symbol(_a, Decl(discriminantPropertyCheck.ts, 102, 11))
>_b : Symbol(_b, Decl(discriminantPropertyCheck.ts, 102, 22))
interface A {
>A : Symbol(A, Decl(discriminantPropertyCheck.ts, 102, 47))
a?: string;
>a : Symbol(A.a, Decl(discriminantPropertyCheck.ts, 104, 13))
b?: string;
>b : Symbol(A.b, Decl(discriminantPropertyCheck.ts, 105, 13))
}
interface B {
>B : Symbol(B, Decl(discriminantPropertyCheck.ts, 107, 1))
a: string;
>a : Symbol(B.a, Decl(discriminantPropertyCheck.ts, 109, 13))
b: string;
>b : Symbol(B.b, Decl(discriminantPropertyCheck.ts, 110, 12))
}
type U = A | B;
>U : Symbol(U, Decl(discriminantPropertyCheck.ts, 112, 1))
>A : Symbol(A, Decl(discriminantPropertyCheck.ts, 102, 47))
>B : Symbol(B, Decl(discriminantPropertyCheck.ts, 107, 1))
const u: U = {} as any;
>u : Symbol(u, Decl(discriminantPropertyCheck.ts, 116, 5))
>U : Symbol(U, Decl(discriminantPropertyCheck.ts, 112, 1))
u.a && u.b && f(u.a, u.b);
>u.a : Symbol(a, Decl(discriminantPropertyCheck.ts, 104, 13), Decl(discriminantPropertyCheck.ts, 109, 13))
>u : Symbol(u, Decl(discriminantPropertyCheck.ts, 116, 5))
>a : Symbol(a, Decl(discriminantPropertyCheck.ts, 104, 13), Decl(discriminantPropertyCheck.ts, 109, 13))
>u.b : Symbol(b, Decl(discriminantPropertyCheck.ts, 105, 13), Decl(discriminantPropertyCheck.ts, 110, 12))
>u : Symbol(u, Decl(discriminantPropertyCheck.ts, 116, 5))
>b : Symbol(b, Decl(discriminantPropertyCheck.ts, 105, 13), Decl(discriminantPropertyCheck.ts, 110, 12))
>f : Symbol(f, Decl(discriminantPropertyCheck.ts, 102, 5))
>u.a : Symbol(a, Decl(discriminantPropertyCheck.ts, 104, 13), Decl(discriminantPropertyCheck.ts, 109, 13))
>u : Symbol(u, Decl(discriminantPropertyCheck.ts, 116, 5))
>a : Symbol(a, Decl(discriminantPropertyCheck.ts, 104, 13), Decl(discriminantPropertyCheck.ts, 109, 13))
>u.b : Symbol(b, Decl(discriminantPropertyCheck.ts, 105, 13), Decl(discriminantPropertyCheck.ts, 110, 12))
>u : Symbol(u, Decl(discriminantPropertyCheck.ts, 116, 5))
>b : Symbol(b, Decl(discriminantPropertyCheck.ts, 105, 13), Decl(discriminantPropertyCheck.ts, 110, 12))
u.b && u.a && f(u.a, u.b);
>u.b : Symbol(b, Decl(discriminantPropertyCheck.ts, 105, 13), Decl(discriminantPropertyCheck.ts, 110, 12))
>u : Symbol(u, Decl(discriminantPropertyCheck.ts, 116, 5))
>b : Symbol(b, Decl(discriminantPropertyCheck.ts, 105, 13), Decl(discriminantPropertyCheck.ts, 110, 12))
>u.a : Symbol(a, Decl(discriminantPropertyCheck.ts, 104, 13), Decl(discriminantPropertyCheck.ts, 109, 13))
>u : Symbol(u, Decl(discriminantPropertyCheck.ts, 116, 5))
>a : Symbol(a, Decl(discriminantPropertyCheck.ts, 104, 13), Decl(discriminantPropertyCheck.ts, 109, 13))
>f : Symbol(f, Decl(discriminantPropertyCheck.ts, 102, 5))
>u.a : Symbol(a, Decl(discriminantPropertyCheck.ts, 104, 13), Decl(discriminantPropertyCheck.ts, 109, 13))
>u : Symbol(u, Decl(discriminantPropertyCheck.ts, 116, 5))
>a : Symbol(a, Decl(discriminantPropertyCheck.ts, 104, 13), Decl(discriminantPropertyCheck.ts, 109, 13))
>u.b : Symbol(b, Decl(discriminantPropertyCheck.ts, 105, 13), Decl(discriminantPropertyCheck.ts, 110, 12))
>u : Symbol(u, Decl(discriminantPropertyCheck.ts, 116, 5))
>b : Symbol(b, Decl(discriminantPropertyCheck.ts, 105, 13), Decl(discriminantPropertyCheck.ts, 110, 12))

View File

@ -310,3 +310,71 @@ function func2(inst: Instance) {
}
}
// Repro from #29106
const f = (_a: string, _b: string): void => {};
>f : (_a: string, _b: string) => void
>(_a: string, _b: string): void => {} : (_a: string, _b: string) => void
>_a : string
>_b : string
interface A {
a?: string;
>a : string | undefined
b?: string;
>b : string | undefined
}
interface B {
a: string;
>a : string
b: string;
>b : string
}
type U = A | B;
>U : U
const u: U = {} as any;
>u : U
>{} as any : any
>{} : {}
u.a && u.b && f(u.a, u.b);
>u.a && u.b && f(u.a, u.b) : void | "" | undefined
>u.a && u.b : string | undefined
>u.a : string | undefined
>u : U
>a : string | undefined
>u.b : string | undefined
>u : U
>b : string | undefined
>f(u.a, u.b) : void
>f : (_a: string, _b: string) => void
>u.a : string
>u : U
>a : string
>u.b : string
>u : U
>b : string
u.b && u.a && f(u.a, u.b);
>u.b && u.a && f(u.a, u.b) : void | "" | undefined
>u.b && u.a : string | undefined
>u.b : string | undefined
>u : U
>b : string | undefined
>u.a : string | undefined
>u : U
>a : string | undefined
>f(u.a, u.b) : void
>f : (_a: string, _b: string) => void
>u.a : string
>u : U
>a : string
>u.b : string
>u : U
>b : string