Accept new baselines

This commit is contained in:
Anders Hejlsberg 2019-06-21 18:07:22 -10:00
parent 9223f39f53
commit 3ca2e7dbb8
4 changed files with 48 additions and 1 deletions

View file

@ -1,9 +1,10 @@
tests/cases/conformance/es6/destructuring/destructuringControlFlow.ts(31,8): error TS2339: Property 'x' does not exist on type 'Number'.
tests/cases/conformance/es6/destructuring/destructuringControlFlow.ts(32,9): error TS2339: Property 'x' does not exist on type 'Number'.
tests/cases/conformance/es6/destructuring/destructuringControlFlow.ts(33,9): error TS2537: Type 'Number' has no matching index signature for type 'string'.
tests/cases/conformance/es6/destructuring/destructuringControlFlow.ts(40,1): error TS2532: Object is possibly 'undefined'.
==== tests/cases/conformance/es6/destructuring/destructuringControlFlow.ts (3 errors) ====
==== tests/cases/conformance/es6/destructuring/destructuringControlFlow.ts (4 errors) ====
function f1(obj: { a?: string }) {
if (obj.a) {
obj = {};
@ -44,4 +45,12 @@ tests/cases/conformance/es6/destructuring/destructuringControlFlow.ts(33,9): err
~~~~~~~~
!!! error TS2537: Type 'Number' has no matching index signature for type 'string'.
}
// Repro from #31770
type KeyValue = [string, string?];
let [key, value]: KeyValue = ["foo"];
value.toUpperCase(); // Error
~~~~~
!!! error TS2532: Object is possibly 'undefined'.

View file

@ -33,6 +33,12 @@ function f4() {
({ ["x"]: x } = 0); // Error
({ ["x" + ""]: x } = 0); // Errpr
}
// Repro from #31770
type KeyValue = [string, string?];
let [key, value]: KeyValue = ["foo"];
value.toUpperCase(); // Error
//// [destructuringControlFlow.js]
@ -69,3 +75,5 @@ function f4() {
(x = 0["x"]); // Error
(_a = "x" + "", x = 0[_a]); // Errpr
}
var _a = ["foo"], key = _a[0], value = _a[1];
value.toUpperCase(); // Error

View file

@ -122,3 +122,16 @@ function f4() {
>x : Symbol(x, Decl(destructuringControlFlow.ts, 29, 7))
}
// Repro from #31770
type KeyValue = [string, string?];
>KeyValue : Symbol(KeyValue, Decl(destructuringControlFlow.ts, 33, 1))
let [key, value]: KeyValue = ["foo"];
>key : Symbol(key, Decl(destructuringControlFlow.ts, 38, 5))
>value : Symbol(value, Decl(destructuringControlFlow.ts, 38, 9))
>KeyValue : Symbol(KeyValue, Decl(destructuringControlFlow.ts, 33, 1))
value.toUpperCase(); // Error
>value : Symbol(value, Decl(destructuringControlFlow.ts, 38, 9))

View file

@ -158,3 +158,20 @@ function f4() {
>0 : 0
}
// Repro from #31770
type KeyValue = [string, string?];
>KeyValue : [string, (string | undefined)?]
let [key, value]: KeyValue = ["foo"];
>key : string
>value : string | undefined
>["foo"] : [string]
>"foo" : "foo"
value.toUpperCase(); // Error
>value.toUpperCase() : any
>value.toUpperCase : any
>value : undefined
>toUpperCase : any