Merge branch 'master' into tscJsFiles

This commit is contained in:
Sheetal Nandi committed 2015-09-14 12:40:47 -07:00
commit 885babc9bc
187 files changed
+4163 -1640

No files matched your search

@@ -100,12 +100,12 @@ var p8 = ({ a = 1 }) => { };
>1 : number
var p9 = ({ a: { b = 1 } = { b: 1 } }) => { };
>p9 : ({ a: { b = 1 } = { b: 1 } }: { a?: { b: number; }; }) => void
>({ a: { b = 1 } = { b: 1 } }) => { } : ({ a: { b = 1 } = { b: 1 } }: { a?: { b: number; }; }) => void
>p9 : ({ a: { b = 1 } = { b: 1 } }: { a?: { b?: number; }; }) => void
>({ a: { b = 1 } = { b: 1 } }) => { } : ({ a: { b = 1 } = { b: 1 } }: { a?: { b?: number; }; }) => void
>a : any
>b : number
>1 : number
>{ b: 1 } : { b: number; }
>{ b: 1 } : { b?: number; }
>b : number
>1 : number
@@ -7,6 +7,11 @@ declare var a;
(<any>[1,3,]);
(<any>"string");
(<any>23.0);
(<any>1);
(<any>1.);
(<any>1.0);
(<any>12e+34);
(<any>0xff);
(<any>/regexp/g);
(<any>false);
(<any>true);
@@ -23,6 +28,12 @@ declare var a;
declare var A;
// should keep the parentheses in emit
(<any>1).foo;
(<any>1.).foo;
(<any>1.0).foo;
(<any>12e+34).foo;
(<any>0xff).foo;
(<any>(1.0));
(<any>new A).foo;
(<any>typeof A).x;
(<any>-A).x;
@@ -46,6 +57,11 @@ new (<any>A());
[1, 3,];
"string";
23.0;
1;
1.;
1.0;
12e+34;
0xff;
/regexp/g;
false;
true;
@@ -59,6 +75,12 @@ a[0];
a.b["0"];
a().x;
// should keep the parentheses in emit
(1).foo;
(1.).foo;
(1.0).foo;
(12e+34).foo;
(0xff).foo;
(1.0);
(new A).foo;
(typeof A).x;
(-A).x;
@@ -10,6 +10,11 @@ declare var a;
(<any>[1,3,]);
(<any>"string");
(<any>23.0);
(<any>1);
(<any>1.);
(<any>1.0);
(<any>12e+34);
(<any>0xff);
(<any>/regexp/g);
(<any>false);
(<any>true);
@@ -33,36 +38,42 @@ declare var a;
>a : Symbol(a, Decl(castExpressionParentheses.ts, 0, 11))
declare var A;
>A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11))
>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11))
// should keep the parentheses in emit
(<any>1).foo;
(<any>1.).foo;
(<any>1.0).foo;
(<any>12e+34).foo;
(<any>0xff).foo;
(<any>(1.0));
(<any>new A).foo;
>A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11))
>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11))
(<any>typeof A).x;
>A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11))
>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11))
(<any>-A).x;
>A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11))
>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11))
new (<any>A());
>A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11))
>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11))
(<Tany>()=> {})();
>Tany : Symbol(Tany, Decl(castExpressionParentheses.ts, 28, 2))
>Tany : Symbol(Tany, Decl(castExpressionParentheses.ts, 39, 2))
(<any>function foo() { })();
>foo : Symbol(foo, Decl(castExpressionParentheses.ts, 29, 6))
>foo : Symbol(foo, Decl(castExpressionParentheses.ts, 40, 6))
(<any><number><any>-A).x;
>A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11))
>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11))
// nested cast, should keep one pair of parenthese
(<any><number>(<any>-A)).x;
>A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11))
>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11))
// nested parenthesized expression, should keep one pair of parenthese
(<any>(A))
>A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11))
>A : Symbol(A, Decl(castExpressionParentheses.ts, 26, 11))
@@ -28,6 +28,31 @@ declare var a;
><any>23.0 : any
>23.0 : number
(<any>1);
>(<any>1) : any
><any>1 : any
>1 : number
(<any>1.);
>(<any>1.) : any
><any>1. : any
>1. : number
(<any>1.0);
>(<any>1.0) : any
><any>1.0 : any
>1.0 : number
(<any>12e+34);
>(<any>12e+34) : any
><any>12e+34 : any
>12e+34 : number
(<any>0xff);
>(<any>0xff) : any
><any>0xff : any
>0xff : number
(<any>/regexp/g);
>(<any>/regexp/g) : any
><any>/regexp/g : any
@@ -104,6 +129,47 @@ declare var A;
>A : any
// should keep the parentheses in emit
(<any>1).foo;
>(<any>1).foo : any
>(<any>1) : any
><any>1 : any
>1 : number
>foo : any
(<any>1.).foo;
>(<any>1.).foo : any
>(<any>1.) : any
><any>1. : any
>1. : number
>foo : any
(<any>1.0).foo;
>(<any>1.0).foo : any
>(<any>1.0) : any
><any>1.0 : any
>1.0 : number
>foo : any
(<any>12e+34).foo;
>(<any>12e+34).foo : any
>(<any>12e+34) : any
><any>12e+34 : any
>12e+34 : number
>foo : any
(<any>0xff).foo;
>(<any>0xff).foo : any
>(<any>0xff) : any
><any>0xff : any
>0xff : number
>foo : any
(<any>(1.0));
>(<any>(1.0)) : any
><any>(1.0) : any
>(1.0) : number
>1.0 : number
(<any>new A).foo;
>(<any>new A).foo : any
>(<any>new A) : any
@@ -1,7 +1,12 @@
//// [tests/cases/compiler/commentOnAmbientClass1.ts] ////
//// [a.ts]
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
/*! Don't keep this pinned comment */
declare class C {
}
@@ -15,6 +20,9 @@ declare class E extends C {
}
//// [a.js]
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
//// [b.js]
///<reference path="a.ts"/>
@@ -5,13 +5,18 @@ declare class E extends C {
>C : Symbol(C, Decl(a.ts, 0, 0))
}
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
/*! Don't keep this pinned comment */
declare class C {
>C : Symbol(C, Decl(a.ts, 0, 0))
}
// Don't keep this comment.
declare class D {
>D : Symbol(D, Decl(a.ts, 2, 1))
>D : Symbol(D, Decl(a.ts, 7, 1))
}
@@ -5,7 +5,12 @@ declare class E extends C {
>C : C
}
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
/*! Don't keep this pinned comment */
declare class C {
>C : C
}
@@ -1,7 +1,12 @@
//// [tests/cases/compiler/commentOnAmbientEnum.ts] ////
//// [a.ts]
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
/*! Don't keep this pinned comment */
declare enum C {
a,
b,
@@ -18,6 +23,9 @@ declare enum E {
}
//// [a.js]
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
//// [b.js]
///<reference path="a.ts"/>
@@ -4,22 +4,27 @@ declare enum E {
>E : Symbol(E, Decl(b.ts, 0, 0))
}
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
/*! Don't keep this pinned comment */
declare enum C {
>C : Symbol(C, Decl(a.ts, 0, 0))
a,
>a : Symbol(C.a, Decl(a.ts, 1, 16))
>a : Symbol(C.a, Decl(a.ts, 6, 16))
b,
>b : Symbol(C.b, Decl(a.ts, 2, 6))
>b : Symbol(C.b, Decl(a.ts, 7, 6))
c
>c : Symbol(C.c, Decl(a.ts, 3, 6))
>c : Symbol(C.c, Decl(a.ts, 8, 6))
}
// Don't keep this comment.
declare enum D {
>D : Symbol(D, Decl(a.ts, 5, 1))
>D : Symbol(D, Decl(a.ts, 10, 1))
}
@@ -4,7 +4,12 @@ declare enum E {
>E : E
}
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
/*! Don't keep this pinned comment */
declare enum C {
>C : C
@@ -1,7 +1,12 @@
//// [tests/cases/compiler/commentOnAmbientModule.ts] ////
//// [a.ts]
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
/*! Don't keep this pinned comment */
declare module C {
function foo();
}
@@ -20,6 +25,9 @@ declare module E {
}
//// [a.js]
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
//// [b.js]
///<reference path="a.ts"/>
@@ -5,28 +5,33 @@ declare module E {
class foobar extends D.bar {
>foobar : Symbol(foobar, Decl(b.ts, 1, 18))
>D.bar : Symbol(D.bar, Decl(a.ts, 6, 18))
>D : Symbol(D, Decl(a.ts, 3, 1))
>bar : Symbol(D.bar, Decl(a.ts, 6, 18))
>D.bar : Symbol(D.bar, Decl(a.ts, 11, 18))
>D : Symbol(D, Decl(a.ts, 8, 1))
>bar : Symbol(D.bar, Decl(a.ts, 11, 18))
foo();
>foo : Symbol(foo, Decl(b.ts, 2, 32))
}
}
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
/*! Don't keep this pinned comment */
declare module C {
>C : Symbol(C, Decl(a.ts, 0, 0))
function foo();
>foo : Symbol(foo, Decl(a.ts, 1, 18))
>foo : Symbol(foo, Decl(a.ts, 6, 18))
}
// Don't keep this comment.
declare module D {
>D : Symbol(D, Decl(a.ts, 3, 1))
>D : Symbol(D, Decl(a.ts, 8, 1))
class bar { }
>bar : Symbol(bar, Decl(a.ts, 6, 18))
>bar : Symbol(bar, Decl(a.ts, 11, 18))
}
@@ -14,7 +14,12 @@ declare module E {
}
}
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
/*! Don't keep this pinned comment */
declare module C {
>C : typeof C
@@ -1,9 +1,17 @@
//// [commentOnAmbientVariable1.ts]
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
/*! Don't keep this pinned comment */
declare var v: number;
// Don't keep this comment.
declare var y: number;
//// [commentOnAmbientVariable1.js]
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
@@ -1,9 +1,14 @@
=== tests/cases/compiler/commentOnAmbientVariable1.ts ===
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
/*! Don't keep this pinned comment */
declare var v: number;
>v : Symbol(v, Decl(commentOnAmbientVariable1.ts, 1, 11))
>v : Symbol(v, Decl(commentOnAmbientVariable1.ts, 6, 11))
// Don't keep this comment.
declare var y: number;
>y : Symbol(y, Decl(commentOnAmbientVariable1.ts, 4, 11))
>y : Symbol(y, Decl(commentOnAmbientVariable1.ts, 9, 11))
@@ -1,5 +1,10 @@
=== tests/cases/compiler/commentOnAmbientVariable1.ts ===
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
/*! Don't keep this pinned comment */
declare var v: number;
>v : number
@@ -1,7 +1,12 @@
//// [tests/cases/compiler/commentOnAmbientfunction.ts] ////
//// [a.ts]
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
/*! Don't keep this pinned comment */
declare function foo();
// Don't keep this comment.
@@ -12,6 +17,9 @@ declare function bar();
declare function foobar(a: typeof foo): typeof bar;
//// [a.js]
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
//// [b.js]
///<reference path="a.ts"/>
@@ -4,14 +4,19 @@ declare function foobar(a: typeof foo): typeof bar;
>foobar : Symbol(foobar, Decl(b.ts, 0, 0))
>a : Symbol(a, Decl(b.ts, 1, 24))
>foo : Symbol(foo, Decl(a.ts, 0, 0))
>bar : Symbol(bar, Decl(a.ts, 1, 23))
>bar : Symbol(bar, Decl(a.ts, 6, 23))
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
/*! Don't keep this pinned comment */
declare function foo();
>foo : Symbol(foo, Decl(a.ts, 0, 0))
// Don't keep this comment.
declare function bar();
>bar : Symbol(bar, Decl(a.ts, 1, 23))
>bar : Symbol(bar, Decl(a.ts, 6, 23))
@@ -7,7 +7,12 @@ declare function foobar(a: typeof foo): typeof bar;
>bar : () => any
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
/*!=========
Keep this pinned comment
=========
*/
/*! Don't keep this pinned comment */
declare function foo();
>foo : () => any
@@ -1,7 +1,12 @@
//// [tests/cases/compiler/commentOnElidedModule1.ts] ////
//// [a.ts]
/*! Keep this pinned comment */
/*!=================
Keep this pinned
=================
*/
/*! Don't keep this pinned comment */
module ElidedModule {
}
@@ -15,6 +20,9 @@ module ElidedModule3 {
}
//// [a.js]
/*! Keep this pinned comment */
/*!=================
Keep this pinned
=================
*/
//// [b.js]
///<reference path="a.ts"/>
@@ -4,13 +4,18 @@ module ElidedModule3 {
>ElidedModule3 : Symbol(ElidedModule3, Decl(b.ts, 0, 0))
}
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
/*!=================
Keep this pinned
=================
*/
/*! Don't keep this pinned comment */
module ElidedModule {
>ElidedModule : Symbol(ElidedModule, Decl(a.ts, 0, 0))
}
// Don't keep this comment.
module ElidedModule2 {
>ElidedModule2 : Symbol(ElidedModule2, Decl(a.ts, 2, 1))
>ElidedModule2 : Symbol(ElidedModule2, Decl(a.ts, 7, 1))
}
@@ -4,7 +4,12 @@ module ElidedModule3 {
>ElidedModule3 : any
}
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
/*!=================
Keep this pinned
=================
*/
/*! Don't keep this pinned comment */
module ElidedModule {
>ElidedModule : any
}
@@ -1,7 +1,12 @@
//// [tests/cases/compiler/commentOnInterface1.ts] ////
//// [a.ts]
/*! Keep this pinned comment */
/*!=================
Keep this pinned
=================
*/
/*! Don't keep this pinned comment */
interface I {
}
@@ -15,6 +20,9 @@ interface I3 {
}
//// [a.js]
/*! Keep this pinned comment */
/*!=================
Keep this pinned
=================
*/
//// [b.js]
///<reference path='a.ts'/>
@@ -4,13 +4,18 @@ interface I3 {
>I3 : Symbol(I3, Decl(b.ts, 0, 0))
}
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
/*!=================
Keep this pinned
=================
*/
/*! Don't keep this pinned comment */
interface I {
>I : Symbol(I, Decl(a.ts, 0, 0))
}
// Don't keep this comment.
interface I2 {
>I2 : Symbol(I2, Decl(a.ts, 2, 1))
>I2 : Symbol(I2, Decl(a.ts, 7, 1))
}
@@ -4,7 +4,12 @@ interface I3 {
>I3 : I3
}
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
/*!=================
Keep this pinned
=================
*/
/*! Don't keep this pinned comment */
interface I {
>I : I
}
@@ -1,7 +1,12 @@
//// [tests/cases/compiler/commentOnSignature1.ts] ////
//// [a.ts]
/*! Keep this pinned comment */
/*!=================
Keep this pinned
=================
*/
/*! Don't keep this pinned comment */
function foo(n: number): void;
// Don't keep this comment.
function foo(s: string): void;
@@ -33,14 +38,15 @@ function foo2(a: any): void {
}
//// [a.js]
/*! Keep this pinned comment */
/*!=================
Keep this pinned
=================
*/
function foo(a) {
}
var c = (function () {
/*! keep this pinned comment */
function c(a) {
}
/*! keep this pinned comment */
c.prototype.foo = function (a) {
};
return c;
@@ -14,49 +14,54 @@ function foo2(a: any): void {
>a : Symbol(a, Decl(b.ts, 4, 14))
}
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
/*!=================
Keep this pinned
=================
*/
/*! Don't keep this pinned comment */
function foo(n: number): void;
>foo : Symbol(foo, Decl(a.ts, 0, 0), Decl(a.ts, 1, 30), Decl(a.ts, 3, 30))
>n : Symbol(n, Decl(a.ts, 1, 13))
>foo : Symbol(foo, Decl(a.ts, 0, 0), Decl(a.ts, 6, 30), Decl(a.ts, 8, 30))
>n : Symbol(n, Decl(a.ts, 6, 13))
// Don't keep this comment.
function foo(s: string): void;
>foo : Symbol(foo, Decl(a.ts, 0, 0), Decl(a.ts, 1, 30), Decl(a.ts, 3, 30))
>s : Symbol(s, Decl(a.ts, 3, 13))
>foo : Symbol(foo, Decl(a.ts, 0, 0), Decl(a.ts, 6, 30), Decl(a.ts, 8, 30))
>s : Symbol(s, Decl(a.ts, 8, 13))
function foo(a: any): void {
>foo : Symbol(foo, Decl(a.ts, 0, 0), Decl(a.ts, 1, 30), Decl(a.ts, 3, 30))
>a : Symbol(a, Decl(a.ts, 4, 13))
>foo : Symbol(foo, Decl(a.ts, 0, 0), Decl(a.ts, 6, 30), Decl(a.ts, 8, 30))
>a : Symbol(a, Decl(a.ts, 9, 13))
}
class c {
>c : Symbol(c, Decl(a.ts, 5, 1))
>c : Symbol(c, Decl(a.ts, 10, 1))
// dont keep this comment
constructor(a: string);
>a : Symbol(a, Decl(a.ts, 9, 16))
>a : Symbol(a, Decl(a.ts, 14, 16))
/*! keep this pinned comment */
constructor(a: number);
>a : Symbol(a, Decl(a.ts, 11, 16))
>a : Symbol(a, Decl(a.ts, 16, 16))
constructor(a: any) {
>a : Symbol(a, Decl(a.ts, 12, 16))
>a : Symbol(a, Decl(a.ts, 17, 16))
}
// dont keep this comment
foo(a: string);
>foo : Symbol(foo, Decl(a.ts, 13, 5), Decl(a.ts, 16, 19), Decl(a.ts, 18, 19))
>a : Symbol(a, Decl(a.ts, 16, 8))
>foo : Symbol(foo, Decl(a.ts, 18, 5), Decl(a.ts, 21, 19), Decl(a.ts, 23, 19))
>a : Symbol(a, Decl(a.ts, 21, 8))
/*! keep this pinned comment */
foo(a: number);
>foo : Symbol(foo, Decl(a.ts, 13, 5), Decl(a.ts, 16, 19), Decl(a.ts, 18, 19))
>a : Symbol(a, Decl(a.ts, 18, 8))
>foo : Symbol(foo, Decl(a.ts, 18, 5), Decl(a.ts, 21, 19), Decl(a.ts, 23, 19))
>a : Symbol(a, Decl(a.ts, 23, 8))
foo(a: any) {
>foo : Symbol(foo, Decl(a.ts, 13, 5), Decl(a.ts, 16, 19), Decl(a.ts, 18, 19))
>a : Symbol(a, Decl(a.ts, 19, 8))
>foo : Symbol(foo, Decl(a.ts, 18, 5), Decl(a.ts, 21, 19), Decl(a.ts, 23, 19))
>a : Symbol(a, Decl(a.ts, 24, 8))
}
}
@@ -14,7 +14,12 @@ function foo2(a: any): void {
>a : any
}
=== tests/cases/compiler/a.ts ===
/*! Keep this pinned comment */
/*!=================
Keep this pinned
=================
*/
/*! Don't keep this pinned comment */
function foo(n: number): void;
>foo : { (n: number): void; (s: string): void; }
>n : number
@@ -21,8 +21,8 @@ function h1(_a) {
//// [declarationEmitDestructuring2.d.ts]
declare function f({x, y: [a, b, c, d]}?: {
x: number;
y: [number, number, number, number];
x?: number;
y?: [number, number, number, number];
}): void;
declare function g([a, b, c, d]?: [number, number, number, number]): void;
declare function h([a, [b], [[c]], {x, y: [a, b, c], z: {a1, b1}}]: [any, [any], [[any]], {
@@ -0,0 +1,17 @@
tests/cases/compiler/declarationEmitDestructuring4.ts(9,22): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
==== tests/cases/compiler/declarationEmitDestructuring4.ts (1 errors) ====
// For an array binding pattern with empty elements,
// we will not make any modification and will emit
// the similar binding pattern users' have written
function baz([]) { }
function baz1([] = [1,2,3]) { }
function baz2([[]] = [[1,2,3]]) { }
function baz3({}) { }
function baz4({} = { x: 10 }) { }
~
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
@@ -1,21 +0,0 @@
=== tests/cases/compiler/declarationEmitDestructuring4.ts ===
// For an array binding pattern with empty elements,
// we will not make any modification and will emit
// the similar binding pattern users' have written
function baz([]) { }
>baz : Symbol(baz, Decl(declarationEmitDestructuring4.ts, 0, 0))
function baz1([] = [1,2,3]) { }
>baz1 : Symbol(baz1, Decl(declarationEmitDestructuring4.ts, 3, 20))
function baz2([[]] = [[1,2,3]]) { }
>baz2 : Symbol(baz2, Decl(declarationEmitDestructuring4.ts, 4, 31))
function baz3({}) { }
>baz3 : Symbol(baz3, Decl(declarationEmitDestructuring4.ts, 5, 35))
function baz4({} = { x: 10 }) { }
>baz4 : Symbol(baz4, Decl(declarationEmitDestructuring4.ts, 7, 21))
>x : Symbol(x, Decl(declarationEmitDestructuring4.ts, 8, 20))
@@ -1,32 +0,0 @@
=== tests/cases/compiler/declarationEmitDestructuring4.ts ===
// For an array binding pattern with empty elements,
// we will not make any modification and will emit
// the similar binding pattern users' have written
function baz([]) { }
>baz : ([]: any[]) => void
function baz1([] = [1,2,3]) { }
>baz1 : ([]?: number[]) => void
>[1,2,3] : number[]
>1 : number
>2 : number
>3 : number
function baz2([[]] = [[1,2,3]]) { }
>baz2 : ([[]]?: [number[]]) => void
>[[1,2,3]] : [number[]]
>[1,2,3] : number[]
>1 : number
>2 : number
>3 : number
function baz3({}) { }
>baz3 : ({}: {}) => void
function baz4({} = { x: 10 }) { }
>baz4 : ({}?: { x: number; }) => void
>{ x: 10 } : { x: number; }
>x : number
>10 : number
@@ -0,0 +1,22 @@
tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts(4,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts(4,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts(4,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
==== tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts (3 errors) ====
var [x10, [y10, [z10]]] = [1, ["hello", [true]]];
var [x11 = 0, y11 = ""] = [1, "hello"];
var [a11, b11, c11] = [];
~~~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
~~~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
~~~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
var [a2, [b2, { x12, y12: c2 }]=["abc", { x12: 10, y12: false }]] = [1, ["hello", { x12: 5, y12: true }]];
var [x13, y13] = [1, "hello"];
var [a3, b3] = [[x13, y13], { x: x13, y: y13 }];
@@ -1,40 +0,0 @@
=== tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts ===
var [x10, [y10, [z10]]] = [1, ["hello", [true]]];
>x10 : Symbol(x10, Decl(declarationEmitDestructuringArrayPattern2.ts, 0, 5))
>y10 : Symbol(y10, Decl(declarationEmitDestructuringArrayPattern2.ts, 0, 11))
>z10 : Symbol(z10, Decl(declarationEmitDestructuringArrayPattern2.ts, 0, 17))
var [x11 = 0, y11 = ""] = [1, "hello"];
>x11 : Symbol(x11, Decl(declarationEmitDestructuringArrayPattern2.ts, 2, 5))
>y11 : Symbol(y11, Decl(declarationEmitDestructuringArrayPattern2.ts, 2, 13))
var [a11, b11, c11] = [];
>a11 : Symbol(a11, Decl(declarationEmitDestructuringArrayPattern2.ts, 3, 5))
>b11 : Symbol(b11, Decl(declarationEmitDestructuringArrayPattern2.ts, 3, 9))
>c11 : Symbol(c11, Decl(declarationEmitDestructuringArrayPattern2.ts, 3, 14))
var [a2, [b2, { x12, y12: c2 }]=["abc", { x12: 10, y12: false }]] = [1, ["hello", { x12: 5, y12: true }]];
>a2 : Symbol(a2, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 5))
>b2 : Symbol(b2, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 10))
>x12 : Symbol(x12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 15))
>y12 : Symbol(y12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 91))
>c2 : Symbol(c2, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 20))
>x12 : Symbol(x12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 41))
>y12 : Symbol(y12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 50))
>x12 : Symbol(x12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 83))
>y12 : Symbol(y12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 91))
var [x13, y13] = [1, "hello"];
>x13 : Symbol(x13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 5))
>y13 : Symbol(y13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 9))
var [a3, b3] = [[x13, y13], { x: x13, y: y13 }];
>a3 : Symbol(a3, Decl(declarationEmitDestructuringArrayPattern2.ts, 8, 5))
>b3 : Symbol(b3, Decl(declarationEmitDestructuringArrayPattern2.ts, 8, 8))
>x13 : Symbol(x13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 5))
>y13 : Symbol(y13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 9))
>x : Symbol(x, Decl(declarationEmitDestructuringArrayPattern2.ts, 8, 29))
>x13 : Symbol(x13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 5))
>y : Symbol(y, Decl(declarationEmitDestructuringArrayPattern2.ts, 8, 37))
>y13 : Symbol(y13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 9))
@@ -1,70 +0,0 @@
=== tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts ===
var [x10, [y10, [z10]]] = [1, ["hello", [true]]];
>x10 : number
>y10 : string
>z10 : boolean
>[1, ["hello", [true]]] : [number, [string, [boolean]]]
>1 : number
>["hello", [true]] : [string, [boolean]]
>"hello" : string
>[true] : [boolean]
>true : boolean
var [x11 = 0, y11 = ""] = [1, "hello"];
>x11 : number
>0 : number
>y11 : string
>"" : string
>[1, "hello"] : [number, string]
>1 : number
>"hello" : string
var [a11, b11, c11] = [];
>a11 : any
>b11 : any
>c11 : any
>[] : undefined[]
var [a2, [b2, { x12, y12: c2 }]=["abc", { x12: 10, y12: false }]] = [1, ["hello", { x12: 5, y12: true }]];
>a2 : number
>b2 : string
>x12 : number
>y12 : any
>c2 : boolean
>["abc", { x12: 10, y12: false }] : [string, { x12: number; y12: boolean; }]
>"abc" : string
>{ x12: 10, y12: false } : { x12: number; y12: boolean; }
>x12 : number
>10 : number
>y12 : boolean
>false : boolean
>[1, ["hello", { x12: 5, y12: true }]] : [number, [string, { x12: number; y12: boolean; }]]
>1 : number
>["hello", { x12: 5, y12: true }] : [string, { x12: number; y12: boolean; }]
>"hello" : string
>{ x12: 5, y12: true } : { x12: number; y12: boolean; }
>x12 : number
>5 : number
>y12 : boolean
>true : boolean
var [x13, y13] = [1, "hello"];
>x13 : number
>y13 : string
>[1, "hello"] : [number, string]
>1 : number
>"hello" : string
var [a3, b3] = [[x13, y13], { x: x13, y: y13 }];
>a3 : (number | string)[]
>b3 : { x: number; y: string; }
>[[x13, y13], { x: x13, y: y13 }] : [(number | string)[], { x: number; y: string; }]
>[x13, y13] : (number | string)[]
>x13 : number
>y13 : string
>{ x: x13, y: y13 } : { x: number; y: string; }
>x : number
>x13 : number
>y : string
>y13 : string
@@ -0,0 +1,43 @@
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(2,13): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(2,19): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(3,23): error TS2353: Object literal may only specify known properties, and 'y4' does not exist in type '{ x4: any; }'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(4,16): error TS2353: Object literal may only specify known properties, and 'x5' does not exist in type '{ y5: any; }'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(6,27): error TS2353: Object literal may only specify known properties, and 'y7' does not exist in type '{ x7: any; }'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(7,20): error TS2353: Object literal may only specify known properties, and 'x8' does not exist in type '{ y8: any; }'.
==== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts (6 errors) ====
var { } = { x: 5, y: "hello" };
~
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
~
!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
var { x4 } = { x4: 5, y4: "hello" };
~~
!!! error TS2353: Object literal may only specify known properties, and 'y4' does not exist in type '{ x4: any; }'.
var { y5 } = { x5: 5, y5: "hello" };
~~
!!! error TS2353: Object literal may only specify known properties, and 'x5' does not exist in type '{ y5: any; }'.
var { x6, y6 } = { x6: 5, y6: "hello" };
var { x7: a1 } = { x7: 5, y7: "hello" };
~~
!!! error TS2353: Object literal may only specify known properties, and 'y7' does not exist in type '{ x7: any; }'.
var { y8: b1 } = { x8: 5, y8: "hello" };
~~
!!! error TS2353: Object literal may only specify known properties, and 'x8' does not exist in type '{ y8: any; }'.
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } };
function f15() {
var a4 = "hello";
var b4 = 1;
var c4 = true;
return { a4, b4, c4 };
}
var { a4, b4, c4 } = f15();
module m {
export var { a4, b4, c4 } = f15();
}
@@ -1,89 +0,0 @@
=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts ===
var { } = { x: 5, y: "hello" };
>x : Symbol(x, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 1, 11))
>y : Symbol(y, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 1, 17))
var { x4 } = { x4: 5, y4: "hello" };
>x4 : Symbol(x4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 2, 5))
>x4 : Symbol(x4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 2, 14))
>y4 : Symbol(y4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 2, 21))
var { y5 } = { x5: 5, y5: "hello" };
>y5 : Symbol(y5, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 3, 5))
>x5 : Symbol(x5, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 3, 14))
>y5 : Symbol(y5, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 3, 21))
var { x6, y6 } = { x6: 5, y6: "hello" };
>x6 : Symbol(x6, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 4, 5))
>y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 4, 9))
>x6 : Symbol(x6, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 4, 18))
>y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 4, 25))
var { x7: a1 } = { x7: 5, y7: "hello" };
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 18))
>a1 : Symbol(a1, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 5))
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 18))
>y7 : Symbol(y7, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 25))
var { y8: b1 } = { x8: 5, y8: "hello" };
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 25))
>b1 : Symbol(b1, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 5))
>x8 : Symbol(x8, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 18))
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 25))
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 26))
>a2 : Symbol(a2, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 5))
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 33))
>b2 : Symbol(b2, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 13))
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 26))
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 33))
var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } };
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 46))
>x11 : Symbol(x11, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 5))
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 52))
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 57))
>y11 : Symbol(y11, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 18))
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 69))
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 74))
>z11 : Symbol(z11, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 31))
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 46))
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 52))
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 57))
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 69))
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 74))
function f15() {
>f15 : Symbol(f15, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 89))
var a4 = "hello";
>a4 : Symbol(a4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 12, 7))
var b4 = 1;
>b4 : Symbol(b4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 13, 7))
var c4 = true;
>c4 : Symbol(c4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 14, 7))
return { a4, b4, c4 };
>a4 : Symbol(a4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 15, 12))
>b4 : Symbol(b4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 15, 16))
>c4 : Symbol(c4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 15, 20))
}
var { a4, b4, c4 } = f15();
>a4 : Symbol(a4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 17, 5))
>b4 : Symbol(b4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 17, 9))
>c4 : Symbol(c4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 17, 13))
>f15 : Symbol(f15, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 89))
module m {
>m : Symbol(m, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 17, 27))
export var { a4, b4, c4 } = f15();
>a4 : Symbol(a4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 20, 16))
>b4 : Symbol(b4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 20, 20))
>c4 : Symbol(c4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 20, 24))
>f15 : Symbol(f15, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 89))
}
@@ -1,122 +0,0 @@
=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts ===
var { } = { x: 5, y: "hello" };
>{ x: 5, y: "hello" } : { x: number; y: string; }
>x : number
>5 : number
>y : string
>"hello" : string
var { x4 } = { x4: 5, y4: "hello" };
>x4 : number
>{ x4: 5, y4: "hello" } : { x4: number; y4: string; }
>x4 : number
>5 : number
>y4 : string
>"hello" : string
var { y5 } = { x5: 5, y5: "hello" };
>y5 : string
>{ x5: 5, y5: "hello" } : { x5: number; y5: string; }
>x5 : number
>5 : number
>y5 : string
>"hello" : string
var { x6, y6 } = { x6: 5, y6: "hello" };
>x6 : number
>y6 : string
>{ x6: 5, y6: "hello" } : { x6: number; y6: string; }
>x6 : number
>5 : number
>y6 : string
>"hello" : string
var { x7: a1 } = { x7: 5, y7: "hello" };
>x7 : any
>a1 : number
>{ x7: 5, y7: "hello" } : { x7: number; y7: string; }
>x7 : number
>5 : number
>y7 : string
>"hello" : string
var { y8: b1 } = { x8: 5, y8: "hello" };
>y8 : any
>b1 : string
>{ x8: 5, y8: "hello" } : { x8: number; y8: string; }
>x8 : number
>5 : number
>y8 : string
>"hello" : string
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
>x9 : any
>a2 : number
>y9 : any
>b2 : string
>{ x9: 5, y9: "hello" } : { x9: number; y9: string; }
>x9 : number
>5 : number
>y9 : string
>"hello" : string
var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } };
>a : any
>x11 : number
>b : any
>a : any
>y11 : string
>b : any
>a : any
>z11 : boolean
>{ a: 1, b: { a: "hello", b: { a: true } } } : { a: number; b: { a: string; b: { a: boolean; }; }; }
>a : number
>1 : number
>b : { a: string; b: { a: boolean; }; }
>{ a: "hello", b: { a: true } } : { a: string; b: { a: boolean; }; }
>a : string
>"hello" : string
>b : { a: boolean; }
>{ a: true } : { a: boolean; }
>a : boolean
>true : boolean
function f15() {
>f15 : () => { a4: string; b4: number; c4: boolean; }
var a4 = "hello";
>a4 : string
>"hello" : string
var b4 = 1;
>b4 : number
>1 : number
var c4 = true;
>c4 : boolean
>true : boolean
return { a4, b4, c4 };
>{ a4, b4, c4 } : { a4: string; b4: number; c4: boolean; }
>a4 : string
>b4 : number
>c4 : boolean
}
var { a4, b4, c4 } = f15();
>a4 : string
>b4 : number
>c4 : boolean
>f15() : { a4: string; b4: number; c4: boolean; }
>f15 : () => { a4: string; b4: number; c4: boolean; }
module m {
>m : typeof m
export var { a4, b4, c4 } = f15();
>a4 : string
>b4 : number
>c4 : boolean
>f15() : { a4: string; b4: number; c4: boolean; }
>f15 : () => { a4: string; b4: number; c4: boolean; }
}
@@ -0,0 +1,29 @@
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(2,13): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(2,19): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(3,23): error TS2353: Object literal may only specify known properties, and 'y4' does not exist in type '{ x4: any; }'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(4,16): error TS2353: Object literal may only specify known properties, and 'x5' does not exist in type '{ y5: any; }'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(6,27): error TS2353: Object literal may only specify known properties, and 'y7' does not exist in type '{ x7: any; }'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(7,20): error TS2353: Object literal may only specify known properties, and 'x8' does not exist in type '{ y8: any; }'.
==== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts (6 errors) ====
var { } = { x: 5, y: "hello" };
~
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
~
!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
var { x4 } = { x4: 5, y4: "hello" };
~~
!!! error TS2353: Object literal may only specify known properties, and 'y4' does not exist in type '{ x4: any; }'.
var { y5 } = { x5: 5, y5: "hello" };
~~
!!! error TS2353: Object literal may only specify known properties, and 'x5' does not exist in type '{ y5: any; }'.
var { x6, y6 } = { x6: 5, y6: "hello" };
var { x7: a1 } = { x7: 5, y7: "hello" };
~~
!!! error TS2353: Object literal may only specify known properties, and 'y7' does not exist in type '{ x7: any; }'.
var { y8: b1 } = { x8: 5, y8: "hello" };
~~
!!! error TS2353: Object literal may only specify known properties, and 'x8' does not exist in type '{ y8: any; }'.
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
@@ -1,42 +0,0 @@
=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts ===
var { } = { x: 5, y: "hello" };
>x : Symbol(x, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 1, 11))
>y : Symbol(y, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 1, 17))
var { x4 } = { x4: 5, y4: "hello" };
>x4 : Symbol(x4, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 2, 5))
>x4 : Symbol(x4, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 2, 14))
>y4 : Symbol(y4, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 2, 21))
var { y5 } = { x5: 5, y5: "hello" };
>y5 : Symbol(y5, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 3, 5))
>x5 : Symbol(x5, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 3, 14))
>y5 : Symbol(y5, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 3, 21))
var { x6, y6 } = { x6: 5, y6: "hello" };
>x6 : Symbol(x6, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 4, 5))
>y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 4, 9))
>x6 : Symbol(x6, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 4, 18))
>y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 4, 25))
var { x7: a1 } = { x7: 5, y7: "hello" };
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 18))
>a1 : Symbol(a1, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 5))
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 18))
>y7 : Symbol(y7, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 25))
var { y8: b1 } = { x8: 5, y8: "hello" };
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 25))
>b1 : Symbol(b1, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 5))
>x8 : Symbol(x8, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 18))
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 25))
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 26))
>a2 : Symbol(a2, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 5))
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 33))
>b2 : Symbol(b2, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 13))
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 26))
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 33))
@@ -1,63 +0,0 @@
=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts ===
var { } = { x: 5, y: "hello" };
>{ x: 5, y: "hello" } : { x: number; y: string; }
>x : number
>5 : number
>y : string
>"hello" : string
var { x4 } = { x4: 5, y4: "hello" };
>x4 : number
>{ x4: 5, y4: "hello" } : { x4: number; y4: string; }
>x4 : number
>5 : number
>y4 : string
>"hello" : string
var { y5 } = { x5: 5, y5: "hello" };
>y5 : string
>{ x5: 5, y5: "hello" } : { x5: number; y5: string; }
>x5 : number
>5 : number
>y5 : string
>"hello" : string
var { x6, y6 } = { x6: 5, y6: "hello" };
>x6 : number
>y6 : string
>{ x6: 5, y6: "hello" } : { x6: number; y6: string; }
>x6 : number
>5 : number
>y6 : string
>"hello" : string
var { x7: a1 } = { x7: 5, y7: "hello" };
>x7 : any
>a1 : number
>{ x7: 5, y7: "hello" } : { x7: number; y7: string; }
>x7 : number
>5 : number
>y7 : string
>"hello" : string
var { y8: b1 } = { x8: 5, y8: "hello" };
>y8 : any
>b1 : string
>{ x8: 5, y8: "hello" } : { x8: number; y8: string; }
>x8 : number
>5 : number
>y8 : string
>"hello" : string
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
>x9 : any
>a2 : number
>y9 : any
>b2 : string
>{ x9: 5, y9: "hello" } : { x9: number; y9: string; }
>x9 : number
>5 : number
>y9 : string
>"hello" : string
@@ -1,11 +1,20 @@
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(5,16): error TS2493: Tuple type '[number, string]' with length '2' cannot be assigned to tuple with length '3'.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(5,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(22,17): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(22,23): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(23,25): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(24,19): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(28,28): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(29,22): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(56,17): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,13): error TS2493: Tuple type '[number]' with length '1' cannot be assigned to tuple with length '3'.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,16): error TS2493: Tuple type '[number]' with length '1' cannot be assigned to tuple with length '3'.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,10): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,13): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,13): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(67,9): error TS2461: Type '{ [x: number]: undefined; }' is not an array type.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(68,9): error TS2461: Type '{ [x: number]: number; 0: number; 1: number; }' is not an array type.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,11): error TS2459: Type '{}' has no property 'a' and no string index signature.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,14): error TS2459: Type '{}' has no property 'b' and no string index signature.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,14): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(74,11): error TS2459: Type 'undefined[]' has no property 'a' and no string index signature.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(74,14): error TS2459: Type 'undefined[]' has no property 'b' and no string index signature.
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(106,5): error TS2345: Argument of type '[number, [string, { y: boolean; }]]' is not assignable to parameter of type '[number, [string, { x: any; y?: boolean; }]]'.
@@ -18,15 +27,15 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,6):
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9): error TS2322: Type 'number' is not assignable to type 'string'.
==== tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts (13 errors) ====
==== tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts (22 errors) ====
function f0() {
var [] = [1, "hello"];
var [x] = [1, "hello"];
var [x, y] = [1, "hello"];
var [x, y, z] = [1, "hello"]; // Error
var [x, y, z] = [1, "hello"];
~
!!! error TS2493: Tuple type '[number, string]' with length '2' cannot be assigned to tuple with length '3'.
var [,, z] = [0, 1, 2];
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
var [,, x] = [0, 1, 2];
var x: number;
var y: string;
}
@@ -42,14 +51,26 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9):
}
function f2() {
var { } = { x: 5, y: "hello" };
var { x } = { x: 5, y: "hello" };
var { y } = { x: 5, y: "hello" };
var { } = { x: 5, y: "hello" }; // Error, no x and y in target
~
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
~
!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
var { x } = { x: 5, y: "hello" }; // Error, no y in target
~
!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'.
var { y } = { x: 5, y: "hello" }; // Error, no x in target
~
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'.
var { x, y } = { x: 5, y: "hello" };
var x: number;
var y: string;
var { x: a } = { x: 5, y: "hello" };
var { y: b } = { x: 5, y: "hello" };
var { x: a } = { x: 5, y: "hello" }; // Error, no y in target
~
!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'.
var { y: b } = { x: 5, y: "hello" }; // Error, no x in target
~
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'.
var { x: a, y: b } = { x: 5, y: "hello" };
var a: number;
var b: string;
@@ -85,11 +106,17 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9):
function f8() {
var [a, b, c] = []; // Ok, [] is an array
~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
var [d, e, f] = [1]; // Error, [1] is a tuple
~
!!! error TS2493: Tuple type '[number]' with length '1' cannot be assigned to tuple with length '3'.
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
~
!!! error TS2493: Tuple type '[number]' with length '1' cannot be assigned to tuple with length '3'.
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
}
function f9() {
@@ -105,9 +132,9 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9):
function f10() {
var { a, b } = {}; // Error
~
!!! error TS2459: Type '{}' has no property 'a' and no string index signature.
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
~
!!! error TS2459: Type '{}' has no property 'b' and no string index signature.
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
var { a, b } = []; // Error
~
!!! error TS2459: Type 'undefined[]' has no property 'a' and no string index signature.
@@ -3,8 +3,8 @@ function f0() {
var [] = [1, "hello"];
var [x] = [1, "hello"];
var [x, y] = [1, "hello"];
var [x, y, z] = [1, "hello"]; // Error
var [,, z] = [0, 1, 2];
var [x, y, z] = [1, "hello"];
var [,, x] = [0, 1, 2];
var x: number;
var y: string;
}
@@ -20,14 +20,14 @@ function f1() {
}
function f2() {
var { } = { x: 5, y: "hello" };
var { x } = { x: 5, y: "hello" };
var { y } = { x: 5, y: "hello" };
var { } = { x: 5, y: "hello" }; // Error, no x and y in target
var { x } = { x: 5, y: "hello" }; // Error, no y in target
var { y } = { x: 5, y: "hello" }; // Error, no x in target
var { x, y } = { x: 5, y: "hello" };
var x: number;
var y: string;
var { x: a } = { x: 5, y: "hello" };
var { y: b } = { x: 5, y: "hello" };
var { x: a } = { x: 5, y: "hello" }; // Error, no y in target
var { y: b } = { x: 5, y: "hello" }; // Error, no x in target
var { x: a, y: b } = { x: 5, y: "hello" };
var a: number;
var b: string;
@@ -185,8 +185,8 @@ function f0() {
var _a = [1, "hello"];
var x = [1, "hello"][0];
var _b = [1, "hello"], x = _b[0], y = _b[1];
var _c = [1, "hello"], x = _c[0], y = _c[1], z = _c[2]; // Error
var _d = [0, 1, 2], z = _d[2];
var _c = [1, "hello"], x = _c[0], y = _c[1], z = _c[2];
var _d = [0, 1, 2], x = _d[2];
var x;
var y;
}
@@ -200,14 +200,14 @@ function f1() {
var z;
}
function f2() {
var _a = { x: 5, y: "hello" };
var x = { x: 5, y: "hello" }.x;
var y = { x: 5, y: "hello" }.y;
var _a = { x: 5, y: "hello" }; // Error, no x and y in target
var x = { x: 5, y: "hello" }.x; // Error, no y in target
var y = { x: 5, y: "hello" }.y; // Error, no x in target
var _b = { x: 5, y: "hello" }, x = _b.x, y = _b.y;
var x;
var y;
var a = { x: 5, y: "hello" }.x;
var b = { x: 5, y: "hello" }.y;
var a = { x: 5, y: "hello" }.x; // Error, no y in target
var b = { x: 5, y: "hello" }.y; // Error, no x in target
var _c = { x: 5, y: "hello" }, a = _c.x, b = _c.y;
var a;
var b;
@@ -0,0 +1,65 @@
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts(43,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts(44,8): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts(44,18): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
==== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts (3 errors) ====
/* AssignmentPattern:
* ObjectAssignmentPattern
* ArrayAssignmentPattern
* ArrayAssignmentPattern:
* [Elision<opt> AssignmentRestElementopt ]
* [AssignmentElementList]
* [AssignmentElementList, Elision<opt> AssignmentRestElementopt ]
* AssignmentElementList:
* Elision<opt> AssignmentElement
* AssignmentElementList, Elisionopt AssignmentElement
* AssignmentElement:
* LeftHandSideExpression Initialiseropt
* AssignmentPattern Initialiseropt
* AssignmentRestElement:
* ... LeftHandSideExpression
*/
// In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left.
// An expression of type S is considered assignable to an assignment target V if one of the following is true
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
// S is the type Any, or
var [a0, a1]: any = undefined;
var [a2 = false, a3 = 1]: any = undefined;
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
// S is a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E,
// where N is the numeric index of E in the array assignment pattern, or
var [b0, b1, b2] = [2, 3, 4];
var [b3, b4, b5]: [number, number, string] = [1, 2, "string"];
function foo() {
return [1, 2, 3];
}
var [b6, b7] = foo();
var [...b8] = foo();
// S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E.
var temp = [1,2,3]
var [c0, c1] = [...temp];
var [c2] = [];
~~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]]
~~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
~~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
var [[c5], c6]: [[string|number], boolean] = [[1], true];
var [, c7] = [1, 2, 3];
var [,,, c8] = [1, 2, 3, 4];
var [,,, c9] = [1, 2, 3, 4];
var [,,,...c10] = [1, 2, 3, 4, "hello"];
var [c11, c12, ...c13] = [1, 2, "string"];
var [c14, c15, c16] = [1, 2, "string"];
@@ -1,105 +0,0 @@
=== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts ===
/* AssignmentPattern:
* ObjectAssignmentPattern
* ArrayAssignmentPattern
* ArrayAssignmentPattern:
* [Elision<opt> AssignmentRestElementopt ]
* [AssignmentElementList]
* [AssignmentElementList, Elision<opt> AssignmentRestElementopt ]
* AssignmentElementList:
* Elision<opt> AssignmentElement
* AssignmentElementList, Elisionopt AssignmentElement
* AssignmentElement:
* LeftHandSideExpression Initialiseropt
* AssignmentPattern Initialiseropt
* AssignmentRestElement:
* ... LeftHandSideExpression
*/
// In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left.
// An expression of type S is considered assignable to an assignment target V if one of the following is true
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
// S is the type Any, or
var [a0, a1]: any = undefined;
>a0 : Symbol(a0, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 23, 5))
>a1 : Symbol(a1, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 23, 8))
>undefined : Symbol(undefined)
var [a2 = false, a3 = 1]: any = undefined;
>a2 : Symbol(a2, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 24, 5))
>a3 : Symbol(a3, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 24, 16))
>undefined : Symbol(undefined)
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
// S is a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E,
// where N is the numeric index of E in the array assignment pattern, or
var [b0, b1, b2] = [2, 3, 4];
>b0 : Symbol(b0, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 29, 5))
>b1 : Symbol(b1, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 29, 8))
>b2 : Symbol(b2, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 29, 12))
var [b3, b4, b5]: [number, number, string] = [1, 2, "string"];
>b3 : Symbol(b3, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 30, 5))
>b4 : Symbol(b4, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 30, 8))
>b5 : Symbol(b5, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 30, 12))
function foo() {
>foo : Symbol(foo, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 30, 62))
return [1, 2, 3];
}
var [b6, b7] = foo();
>b6 : Symbol(b6, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 36, 5))
>b7 : Symbol(b7, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 36, 8))
>foo : Symbol(foo, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 30, 62))
var [...b8] = foo();
>b8 : Symbol(b8, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 37, 5))
>foo : Symbol(foo, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 30, 62))
// S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E.
var temp = [1,2,3]
>temp : Symbol(temp, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 40, 3))
var [c0, c1] = [...temp];
>c0 : Symbol(c0, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 41, 5))
>c1 : Symbol(c1, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 41, 8))
>temp : Symbol(temp, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 40, 3))
var [c2] = [];
>c2 : Symbol(c2, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 42, 5))
var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]]
>c3 : Symbol(c3, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 43, 7))
>c4 : Symbol(c4, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 43, 17))
var [[c5], c6]: [[string|number], boolean] = [[1], true];
>c5 : Symbol(c5, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 44, 6))
>c6 : Symbol(c6, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 44, 10))
var [, c7] = [1, 2, 3];
>c7 : Symbol(c7, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 45, 6))
var [,,, c8] = [1, 2, 3, 4];
>c8 : Symbol(c8, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 46, 8))
var [,,, c9] = [1, 2, 3, 4];
>c9 : Symbol(c9, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 47, 8))
var [,,,...c10] = [1, 2, 3, 4, "hello"];
>c10 : Symbol(c10, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 48, 8))
var [c11, c12, ...c13] = [1, 2, "string"];
>c11 : Symbol(c11, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 49, 5))
>c12 : Symbol(c12, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 49, 9))
>c13 : Symbol(c13, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 49, 14))
var [c14, c15, c16] = [1, 2, "string"];
>c14 : Symbol(c14, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 50, 5))
>c15 : Symbol(c15, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 50, 9))
>c16 : Symbol(c16, Decl(destructuringArrayBindingPatternAndAssignment1ES5.ts, 50, 14))
@@ -1,177 +0,0 @@
=== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5.ts ===
/* AssignmentPattern:
* ObjectAssignmentPattern
* ArrayAssignmentPattern
* ArrayAssignmentPattern:
* [Elision<opt> AssignmentRestElementopt ]
* [AssignmentElementList]
* [AssignmentElementList, Elision<opt> AssignmentRestElementopt ]
* AssignmentElementList:
* Elision<opt> AssignmentElement
* AssignmentElementList, Elisionopt AssignmentElement
* AssignmentElement:
* LeftHandSideExpression Initialiseropt
* AssignmentPattern Initialiseropt
* AssignmentRestElement:
* ... LeftHandSideExpression
*/
// In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left.
// An expression of type S is considered assignable to an assignment target V if one of the following is true
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
// S is the type Any, or
var [a0, a1]: any = undefined;
>a0 : any
>a1 : any
>undefined : undefined
var [a2 = false, a3 = 1]: any = undefined;
>a2 : boolean
>false : boolean
>a3 : number
>1 : number
>undefined : undefined
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
// S is a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E,
// where N is the numeric index of E in the array assignment pattern, or
var [b0, b1, b2] = [2, 3, 4];
>b0 : number
>b1 : number
>b2 : number
>[2, 3, 4] : [number, number, number]
>2 : number
>3 : number
>4 : number
var [b3, b4, b5]: [number, number, string] = [1, 2, "string"];
>b3 : number
>b4 : number
>b5 : string
>[1, 2, "string"] : [number, number, string]
>1 : number
>2 : number
>"string" : string
function foo() {
>foo : () => number[]
return [1, 2, 3];
>[1, 2, 3] : number[]
>1 : number
>2 : number
>3 : number
}
var [b6, b7] = foo();
>b6 : number
>b7 : number
>foo() : number[]
>foo : () => number[]
var [...b8] = foo();
>b8 : number[]
>foo() : number[]
>foo : () => number[]
// S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E.
var temp = [1,2,3]
>temp : number[]
>[1,2,3] : number[]
>1 : number
>2 : number
>3 : number
var [c0, c1] = [...temp];
>c0 : number
>c1 : number
>[...temp] : number[]
>...temp : number
>temp : number[]
var [c2] = [];
>c2 : any
>[] : undefined[]
var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]]
>c3 : any
>c4 : any
>[[[]], [[[[]]]]] : [[undefined[]], [[[undefined[]]]]]
>[[]] : [undefined[]]
>[] : undefined[]
>[[[[]]]] : [[[undefined[]]]]
>[[[]]] : [[undefined[]]]
>[[]] : [undefined[]]
>[] : undefined[]
var [[c5], c6]: [[string|number], boolean] = [[1], true];
>c5 : string | number
>c6 : boolean
>[[1], true] : [[number], boolean]
>[1] : [number]
>1 : number
>true : boolean
var [, c7] = [1, 2, 3];
> : undefined
>c7 : number
>[1, 2, 3] : [number, number, number]
>1 : number
>2 : number
>3 : number
var [,,, c8] = [1, 2, 3, 4];
> : undefined
> : undefined
> : undefined
>c8 : number
>[1, 2, 3, 4] : [number, number, number, number]
>1 : number
>2 : number
>3 : number
>4 : number
var [,,, c9] = [1, 2, 3, 4];
> : undefined
> : undefined
> : undefined
>c9 : number
>[1, 2, 3, 4] : [number, number, number, number]
>1 : number
>2 : number
>3 : number
>4 : number
var [,,,...c10] = [1, 2, 3, 4, "hello"];
> : undefined
> : undefined
> : undefined
>c10 : (number | string)[]
>[1, 2, 3, 4, "hello"] : (number | string)[]
>1 : number
>2 : number
>3 : number
>4 : number
>"hello" : string
var [c11, c12, ...c13] = [1, 2, "string"];
>c11 : number | string
>c12 : number | string
>c13 : (number | string)[]
>[1, 2, "string"] : (number | string)[]
>1 : number
>2 : number
>"string" : string
var [c14, c15, c16] = [1, 2, "string"];
>c14 : number
>c15 : number
>c16 : string
>[1, 2, "string"] : [number, number, string]
>1 : number
>2 : number
>"string" : string
@@ -0,0 +1,64 @@
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts(44,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts(45,8): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts(45,18): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
==== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts (3 errors) ====
/* AssignmentPattern:
* ObjectAssignmentPattern
* ArrayAssignmentPattern
* ArrayAssignmentPattern:
* [Elision<opt> AssignmentRestElementopt ]
* [AssignmentElementList]
* [AssignmentElementList, Elision<opt> AssignmentRestElementopt ]
* AssignmentElementList:
* Elision<opt> AssignmentElement
* AssignmentElementList, Elisionopt AssignmentElement
* AssignmentElement:
* LeftHandSideExpression Initialiseropt
* AssignmentPattern Initialiseropt
* AssignmentRestElement:
* ... LeftHandSideExpression
*/
// In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left.
// An expression of type S is considered assignable to an assignment target V if one of the following is true
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
// S is the type Any, or
var [a0, a1]: any = undefined;
var [a2 = false, a3 = 1]: any = undefined;
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
// S is a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E,
// where N is the numeric index of E in the array assignment pattern, or
var [b0, b1, b2] = [2, 3, 4];
var [b3, b4, b5]: [number, number, string] = [1, 2, "string"];
function foo() {
return [1, 2, 3];
}
var [b6, b7] = foo();
var [...b8] = foo();
// S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E.
var temp = [1,2,3]
var [c0, c1] = [...temp];
var [c2] = [];
~~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]]
~~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
~~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
var [[c5], c6]: [[string|number], boolean] = [[1], true];
var [, c7] = [1, 2, 3];
var [,,, c8] = [1, 2, 3, 4];
var [,,, c9] = [1, 2, 3, 4];
var [,,,...c10] = [1, 2, 3, 4, "hello"];
var [c11, c12, ...c13] = [1, 2, "string"];
var [c14, c15, c16] = [1, 2, "string"];
@@ -1,105 +0,0 @@
=== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts ===
/* AssignmentPattern:
* ObjectAssignmentPattern
* ArrayAssignmentPattern
* ArrayAssignmentPattern:
* [Elision<opt> AssignmentRestElementopt ]
* [AssignmentElementList]
* [AssignmentElementList, Elision<opt> AssignmentRestElementopt ]
* AssignmentElementList:
* Elision<opt> AssignmentElement
* AssignmentElementList, Elisionopt AssignmentElement
* AssignmentElement:
* LeftHandSideExpression Initialiseropt
* AssignmentPattern Initialiseropt
* AssignmentRestElement:
* ... LeftHandSideExpression
*/
// In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left.
// An expression of type S is considered assignable to an assignment target V if one of the following is true
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
// S is the type Any, or
var [a0, a1]: any = undefined;
>a0 : Symbol(a0, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 24, 5))
>a1 : Symbol(a1, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 24, 8))
>undefined : Symbol(undefined)
var [a2 = false, a3 = 1]: any = undefined;
>a2 : Symbol(a2, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 25, 5))
>a3 : Symbol(a3, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 25, 16))
>undefined : Symbol(undefined)
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
// S is a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E,
// where N is the numeric index of E in the array assignment pattern, or
var [b0, b1, b2] = [2, 3, 4];
>b0 : Symbol(b0, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 30, 5))
>b1 : Symbol(b1, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 30, 8))
>b2 : Symbol(b2, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 30, 12))
var [b3, b4, b5]: [number, number, string] = [1, 2, "string"];
>b3 : Symbol(b3, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 31, 5))
>b4 : Symbol(b4, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 31, 8))
>b5 : Symbol(b5, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 31, 12))
function foo() {
>foo : Symbol(foo, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 31, 62))
return [1, 2, 3];
}
var [b6, b7] = foo();
>b6 : Symbol(b6, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 37, 5))
>b7 : Symbol(b7, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 37, 8))
>foo : Symbol(foo, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 31, 62))
var [...b8] = foo();
>b8 : Symbol(b8, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 38, 5))
>foo : Symbol(foo, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 31, 62))
// S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E.
var temp = [1,2,3]
>temp : Symbol(temp, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 41, 3))
var [c0, c1] = [...temp];
>c0 : Symbol(c0, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 42, 5))
>c1 : Symbol(c1, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 42, 8))
>temp : Symbol(temp, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 41, 3))
var [c2] = [];
>c2 : Symbol(c2, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 43, 5))
var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]]
>c3 : Symbol(c3, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 44, 7))
>c4 : Symbol(c4, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 44, 17))
var [[c5], c6]: [[string|number], boolean] = [[1], true];
>c5 : Symbol(c5, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 45, 6))
>c6 : Symbol(c6, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 45, 10))
var [, c7] = [1, 2, 3];
>c7 : Symbol(c7, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 46, 6))
var [,,, c8] = [1, 2, 3, 4];
>c8 : Symbol(c8, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 47, 8))
var [,,, c9] = [1, 2, 3, 4];
>c9 : Symbol(c9, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 48, 8))
var [,,,...c10] = [1, 2, 3, 4, "hello"];
>c10 : Symbol(c10, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 49, 8))
var [c11, c12, ...c13] = [1, 2, "string"];
>c11 : Symbol(c11, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 50, 5))
>c12 : Symbol(c12, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 50, 9))
>c13 : Symbol(c13, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 50, 14))
var [c14, c15, c16] = [1, 2, "string"];
>c14 : Symbol(c14, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 51, 5))
>c15 : Symbol(c15, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 51, 9))
>c16 : Symbol(c16, Decl(destructuringArrayBindingPatternAndAssignment1ES6.ts, 51, 14))
@@ -1,177 +0,0 @@
=== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES6.ts ===
/* AssignmentPattern:
* ObjectAssignmentPattern
* ArrayAssignmentPattern
* ArrayAssignmentPattern:
* [Elision<opt> AssignmentRestElementopt ]
* [AssignmentElementList]
* [AssignmentElementList, Elision<opt> AssignmentRestElementopt ]
* AssignmentElementList:
* Elision<opt> AssignmentElement
* AssignmentElementList, Elisionopt AssignmentElement
* AssignmentElement:
* LeftHandSideExpression Initialiseropt
* AssignmentPattern Initialiseropt
* AssignmentRestElement:
* ... LeftHandSideExpression
*/
// In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left.
// An expression of type S is considered assignable to an assignment target V if one of the following is true
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
// S is the type Any, or
var [a0, a1]: any = undefined;
>a0 : any
>a1 : any
>undefined : undefined
var [a2 = false, a3 = 1]: any = undefined;
>a2 : boolean
>false : boolean
>a3 : number
>1 : number
>undefined : undefined
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
// S is a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E,
// where N is the numeric index of E in the array assignment pattern, or
var [b0, b1, b2] = [2, 3, 4];
>b0 : number
>b1 : number
>b2 : number
>[2, 3, 4] : [number, number, number]
>2 : number
>3 : number
>4 : number
var [b3, b4, b5]: [number, number, string] = [1, 2, "string"];
>b3 : number
>b4 : number
>b5 : string
>[1, 2, "string"] : [number, number, string]
>1 : number
>2 : number
>"string" : string
function foo() {
>foo : () => number[]
return [1, 2, 3];
>[1, 2, 3] : number[]
>1 : number
>2 : number
>3 : number
}
var [b6, b7] = foo();
>b6 : number
>b7 : number
>foo() : number[]
>foo : () => number[]
var [...b8] = foo();
>b8 : number[]
>foo() : number[]
>foo : () => number[]
// S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E.
var temp = [1,2,3]
>temp : number[]
>[1,2,3] : number[]
>1 : number
>2 : number
>3 : number
var [c0, c1] = [...temp];
>c0 : number
>c1 : number
>[...temp] : number[]
>...temp : number
>temp : number[]
var [c2] = [];
>c2 : any
>[] : undefined[]
var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]]
>c3 : any
>c4 : any
>[[[]], [[[[]]]]] : [[undefined[]], [[[undefined[]]]]]
>[[]] : [undefined[]]
>[] : undefined[]
>[[[[]]]] : [[[undefined[]]]]
>[[[]]] : [[undefined[]]]
>[[]] : [undefined[]]
>[] : undefined[]
var [[c5], c6]: [[string|number], boolean] = [[1], true];
>c5 : string | number
>c6 : boolean
>[[1], true] : [[number], boolean]
>[1] : [number]
>1 : number
>true : boolean
var [, c7] = [1, 2, 3];
> : undefined
>c7 : number
>[1, 2, 3] : [number, number, number]
>1 : number
>2 : number
>3 : number
var [,,, c8] = [1, 2, 3, 4];
> : undefined
> : undefined
> : undefined
>c8 : number
>[1, 2, 3, 4] : [number, number, number, number]
>1 : number
>2 : number
>3 : number
>4 : number
var [,,, c9] = [1, 2, 3, 4];
> : undefined
> : undefined
> : undefined
>c9 : number
>[1, 2, 3, 4] : [number, number, number, number]
>1 : number
>2 : number
>3 : number
>4 : number
var [,,,...c10] = [1, 2, 3, 4, "hello"];
> : undefined
> : undefined
> : undefined
>c10 : (number | string)[]
>[1, 2, 3, 4, "hello"] : (number | string)[]
>1 : number
>2 : number
>3 : number
>4 : number
>"hello" : string
var [c11, c12, ...c13] = [1, 2, "string"];
>c11 : number | string
>c12 : number | string
>c13 : (number | string)[]
>[1, 2, "string"] : (number | string)[]
>1 : number
>2 : number
>"string" : string
var [c14, c15, c16] = [1, 2, "string"];
>c14 : number
>c15 : number
>c16 : string
>[1, 2, "string"] : [number, number, string]
>1 : number
>2 : number
>"string" : string
@@ -1,5 +1,5 @@
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,6): error TS2461: Type 'undefined' is not an array type.
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,12): error TS2461: Type 'undefined' is not an array type.
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(3,12): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(4,5): error TS2461: Type 'undefined' is not an array type.
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(9,5): error TS2322: Type '[number, number, string]' is not assignable to type '[number, boolean, string]'.
Types of property '1' are incompatible.
@@ -18,9 +18,9 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss
// S is the type Any, or
var [[a0], [[a1]]] = [] // Error
~~~~
!!! error TS2461: Type 'undefined' is not an array type.
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
~~~~~~
!!! error TS2461: Type 'undefined' is not an array type.
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
var [[a2], [[a3]]] = undefined // Error
~~~~~~~~~~~~~~
!!! error TS2461: Type 'undefined' is not an array type.
@@ -27,7 +27,7 @@ var { b2: { b21 } = { b21: "string" } } = { b2: { b21: "world" } };
>{ b21: "string" } : { b21: string; }
>b21 : string
>"string" : string
>{ b2: { b21: "world" } } : { b2: { b21: string; }; }
>{ b2: { b21: "world" } } : { b2?: { b21: string; }; }
>b2 : { b21: string; }
>{ b21: "world" } : { b21: string; }
>b21 : string
@@ -27,7 +27,7 @@ var { b2: { b21 } = { b21: "string" } } = { b2: { b21: "world" } };
>{ b21: "string" } : { b21: string; }
>b21 : string
>"string" : string
>{ b2: { b21: "world" } } : { b2: { b21: string; }; }
>{ b2: { b21: "world" } } : { b2?: { b21: string; }; }
>b2 : { b21: string; }
>{ b21: "world" } : { b21: string; }
>b21 : string
@@ -3,14 +3,18 @@ tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAs
Type '{ i: number; }' is not assignable to type 'number'.
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(3,6): error TS2459: Type 'string | number' has no property 'i' and no string index signature.
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(4,6): error TS2459: Type 'string | number | {}' has no property 'i1' and no string index signature.
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(5,12): error TS2459: Type '{ f212: string; }' has no property 'f21' and no string index signature.
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(5,12): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(5,21): error TS2353: Object literal may only specify known properties, and 'f212' does not exist in type '{ f21: any; }'.
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(6,7): error TS1180: Property destructuring pattern expected.
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(7,5): error TS2353: Object literal may only specify known properties, and 'a' does not exist in type '{ d1: any; }'.
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(7,11): error TS2353: Object literal may only specify known properties, and 'b' does not exist in type '{ d1: any; }'.
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(7,24): error TS2353: Object literal may only specify known properties, and 'e' does not exist in type '{ d1: any; }'.
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(9,7): error TS1005: ':' expected.
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(9,15): error TS1005: ':' expected.
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts(10,12): error TS1005: ':' expected.
==== tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts (9 errors) ====
==== tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment3.ts (13 errors) ====
// Error
var {h?} = { h?: 1 };
~
@@ -26,11 +30,19 @@ tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAs
!!! error TS2459: Type 'string | number | {}' has no property 'i1' and no string index signature.
var { f2: {f21} = { f212: "string" } }: any = undefined;
~~~
!!! error TS2459: Type '{ f212: string; }' has no property 'f21' and no string index signature.
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
~~~~
!!! error TS2353: Object literal may only specify known properties, and 'f212' does not exist in type '{ f21: any; }'.
var { ...d1 } = {
~~~
!!! error TS1180: Property destructuring pattern expected.
a: 1, b: 1, d1: 9, e: 10
~
!!! error TS2353: Object literal may only specify known properties, and 'a' does not exist in type '{ d1: any; }'.
~
!!! error TS2353: Object literal may only specify known properties, and 'b' does not exist in type '{ d1: any; }'.
~
!!! error TS2353: Object literal may only specify known properties, and 'e' does not exist in type '{ d1: any; }'.
}
var {1} = { 1 };
~
@@ -31,7 +31,7 @@ var { b1: { b11 } = { b11: "string" } } = { b1: { b11: "world" } };
>{ b11: "string" } : { b11: string; }
>b11 : string
>"string" : string
>{ b1: { b11: "world" } } : { b1: { b11: string; }; }
>{ b1: { b11: "world" } } : { b1?: { b11: string; }; }
>b1 : { b11: string; }
>{ b11: "world" } : { b11: string; }
>b11 : string
@@ -151,9 +151,9 @@ var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] };
>f4 : number
>f5 : number
> : undefined
>{ f: [1, 2, { f3: 4, f5: 0 }] } : { f: [number, number, { f3: number; f5: number; }]; }
>f : [number, number, { f3: number; f5: number; }]
>[1, 2, { f3: 4, f5: 0 }] : [number, number, { f3: number; f5: number; }]
>{ f: [1, 2, { f3: 4, f5: 0 }] } : { f: [number, number, { f3: number; f5: number; }, any]; }
>f : [number, number, { f3: number; f5: number; }, any]
>[1, 2, { f3: 4, f5: 0 }] : [number, number, { f3: number; f5: number; }, any]
>1 : number
>2 : number
>{ f3: 4, f5: 0 } : { f3: number; f5: number; }
@@ -31,7 +31,7 @@ var { b1: { b11 } = { b11: "string" } } = { b1: { b11: "world" } };
>{ b11: "string" } : { b11: string; }
>b11 : string
>"string" : string
>{ b1: { b11: "world" } } : { b1: { b11: string; }; }
>{ b1: { b11: "world" } } : { b1?: { b11: string; }; }
>b1 : { b11: string; }
>{ b11: "world" } : { b11: string; }
>b11 : string
@@ -151,9 +151,9 @@ var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] };
>f4 : number
>f5 : number
> : undefined
>{ f: [1, 2, { f3: 4, f5: 0 }] } : { f: [number, number, { f3: number; f5: number; }]; }
>f : [number, number, { f3: number; f5: number; }]
>[1, 2, { f3: 4, f5: 0 }] : [number, number, { f3: number; f5: number; }]
>{ f: [1, 2, { f3: 4, f5: 0 }] } : { f: [number, number, { f3: number; f5: number; }, any]; }
>f : [number, number, { f3: number; f5: number; }, any]
>[1, 2, { f3: 4, f5: 0 }] : [number, number, { f3: number; f5: number; }, any]
>1 : number
>2 : number
>{ f3: 4, f5: 0 } : { f3: number; f5: number; }
@@ -0,0 +1,147 @@
//// [destructuringWithLiteralInitializers.ts]
// (arg: { x: any, y: any }) => void
function f1({ x, y }) { }
f1({ x: 1, y: 1 });
// (arg: { x: any, y?: number }) => void
function f2({ x, y = 0 }) { }
f2({ x: 1 });
f2({ x: 1, y: 1 });
// (arg: { x?: number, y?: number }) => void
function f3({ x = 0, y = 0 }) { }
f3({});
f3({ x: 1 });
f3({ y: 1 });
f3({ x: 1, y: 1 });
// (arg?: { x: number, y: number }) => void
function f4({ x, y } = { x: 0, y: 0 }) { }
f4();
f4({ x: 1, y: 1 });
// (arg?: { x: number, y?: number }) => void
function f5({ x, y = 0 } = { x: 0 }) { }
f5();
f5({ x: 1 });
f5({ x: 1, y: 1 });
// (arg?: { x?: number, y?: number }) => void
function f6({ x = 0, y = 0 } = {}) { }
f6();
f6({});
f6({ x: 1 });
f6({ y: 1 });
f6({ x: 1, y: 1 });
// (arg?: { a: { x?: number, y?: number } }) => void
function f7({ a: { x = 0, y = 0 } } = { a: {} }) { }
f7();
f7({ a: {} });
f7({ a: { x: 1 } });
f7({ a: { y: 1 } });
f7({ a: { x: 1, y: 1 } });
// (arg: [any, any]) => void
function g1([x, y]) { }
g1([1, 1]);
// (arg: [number, number]) => void
function g2([x = 0, y = 0]) { }
g2([1, 1]);
// (arg?: [number, number]) => void
function g3([x, y] = [0, 0]) { }
g3();
g3([1, 1]);
// (arg?: [number, number]) => void
function g4([x, y = 0] = [0]) { }
g4();
g4([1, 1]);
// (arg?: [number, number]) => void
function g5([x = 0, y = 0] = []) { }
g5();
g5([1, 1]);
//// [destructuringWithLiteralInitializers.js]
// (arg: { x: any, y: any }) => void
function f1(_a) {
var x = _a.x, y = _a.y;
}
f1({ x: 1, y: 1 });
// (arg: { x: any, y?: number }) => void
function f2(_a) {
var x = _a.x, _b = _a.y, y = _b === void 0 ? 0 : _b;
}
f2({ x: 1 });
f2({ x: 1, y: 1 });
// (arg: { x?: number, y?: number }) => void
function f3(_a) {
var _b = _a.x, x = _b === void 0 ? 0 : _b, _c = _a.y, y = _c === void 0 ? 0 : _c;
}
f3({});
f3({ x: 1 });
f3({ y: 1 });
f3({ x: 1, y: 1 });
// (arg?: { x: number, y: number }) => void
function f4(_a) {
var _b = _a === void 0 ? { x: 0, y: 0 } : _a, x = _b.x, y = _b.y;
}
f4();
f4({ x: 1, y: 1 });
// (arg?: { x: number, y?: number }) => void
function f5(_a) {
var _b = _a === void 0 ? { x: 0 } : _a, x = _b.x, _c = _b.y, y = _c === void 0 ? 0 : _c;
}
f5();
f5({ x: 1 });
f5({ x: 1, y: 1 });
// (arg?: { x?: number, y?: number }) => void
function f6(_a) {
var _b = _a === void 0 ? {} : _a, _c = _b.x, x = _c === void 0 ? 0 : _c, _d = _b.y, y = _d === void 0 ? 0 : _d;
}
f6();
f6({});
f6({ x: 1 });
f6({ y: 1 });
f6({ x: 1, y: 1 });
// (arg?: { a: { x?: number, y?: number } }) => void
function f7(_a) {
var _b = (_a === void 0 ? { a: {} } : _a).a, _c = _b.x, x = _c === void 0 ? 0 : _c, _d = _b.y, y = _d === void 0 ? 0 : _d;
}
f7();
f7({ a: {} });
f7({ a: { x: 1 } });
f7({ a: { y: 1 } });
f7({ a: { x: 1, y: 1 } });
// (arg: [any, any]) => void
function g1(_a) {
var x = _a[0], y = _a[1];
}
g1([1, 1]);
// (arg: [number, number]) => void
function g2(_a) {
var _b = _a[0], x = _b === void 0 ? 0 : _b, _c = _a[1], y = _c === void 0 ? 0 : _c;
}
g2([1, 1]);
// (arg?: [number, number]) => void
function g3(_a) {
var _b = _a === void 0 ? [0, 0] : _a, x = _b[0], y = _b[1];
}
g3();
g3([1, 1]);
// (arg?: [number, number]) => void
function g4(_a) {
var _b = _a === void 0 ? [0] : _a, x = _b[0], _c = _b[1], y = _c === void 0 ? 0 : _c;
}
g4();
g4([1, 1]);
// (arg?: [number, number]) => void
function g5(_a) {
var _b = _a === void 0 ? [] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 0 : _d;
}
g5();
g5([1, 1]);
@@ -0,0 +1,194 @@
=== tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers.ts ===
// (arg: { x: any, y: any }) => void
function f1({ x, y }) { }
>f1 : Symbol(f1, Decl(destructuringWithLiteralInitializers.ts, 0, 0))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 1, 13))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 1, 16))
f1({ x: 1, y: 1 });
>f1 : Symbol(f1, Decl(destructuringWithLiteralInitializers.ts, 0, 0))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 2, 4))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 2, 10))
// (arg: { x: any, y?: number }) => void
function f2({ x, y = 0 }) { }
>f2 : Symbol(f2, Decl(destructuringWithLiteralInitializers.ts, 2, 19))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 5, 13))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 5, 16))
f2({ x: 1 });
>f2 : Symbol(f2, Decl(destructuringWithLiteralInitializers.ts, 2, 19))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 6, 4))
f2({ x: 1, y: 1 });
>f2 : Symbol(f2, Decl(destructuringWithLiteralInitializers.ts, 2, 19))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 7, 4))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 7, 10))
// (arg: { x?: number, y?: number }) => void
function f3({ x = 0, y = 0 }) { }
>f3 : Symbol(f3, Decl(destructuringWithLiteralInitializers.ts, 7, 19))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 10, 13))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 10, 20))
f3({});
>f3 : Symbol(f3, Decl(destructuringWithLiteralInitializers.ts, 7, 19))
f3({ x: 1 });
>f3 : Symbol(f3, Decl(destructuringWithLiteralInitializers.ts, 7, 19))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 12, 4))
f3({ y: 1 });
>f3 : Symbol(f3, Decl(destructuringWithLiteralInitializers.ts, 7, 19))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 13, 4))
f3({ x: 1, y: 1 });
>f3 : Symbol(f3, Decl(destructuringWithLiteralInitializers.ts, 7, 19))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 14, 4))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 14, 10))
// (arg?: { x: number, y: number }) => void
function f4({ x, y } = { x: 0, y: 0 }) { }
>f4 : Symbol(f4, Decl(destructuringWithLiteralInitializers.ts, 14, 19))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 17, 13))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 17, 16))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 17, 24))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 17, 30))
f4();
>f4 : Symbol(f4, Decl(destructuringWithLiteralInitializers.ts, 14, 19))
f4({ x: 1, y: 1 });
>f4 : Symbol(f4, Decl(destructuringWithLiteralInitializers.ts, 14, 19))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 19, 4))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 19, 10))
// (arg?: { x: number, y?: number }) => void
function f5({ x, y = 0 } = { x: 0 }) { }
>f5 : Symbol(f5, Decl(destructuringWithLiteralInitializers.ts, 19, 19))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 22, 13))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 22, 16))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 22, 28))
f5();
>f5 : Symbol(f5, Decl(destructuringWithLiteralInitializers.ts, 19, 19))
f5({ x: 1 });
>f5 : Symbol(f5, Decl(destructuringWithLiteralInitializers.ts, 19, 19))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 24, 4))
f5({ x: 1, y: 1 });
>f5 : Symbol(f5, Decl(destructuringWithLiteralInitializers.ts, 19, 19))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 25, 4))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 25, 10))
// (arg?: { x?: number, y?: number }) => void
function f6({ x = 0, y = 0 } = {}) { }
>f6 : Symbol(f6, Decl(destructuringWithLiteralInitializers.ts, 25, 19))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 28, 13))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 28, 20))
f6();
>f6 : Symbol(f6, Decl(destructuringWithLiteralInitializers.ts, 25, 19))
f6({});
>f6 : Symbol(f6, Decl(destructuringWithLiteralInitializers.ts, 25, 19))
f6({ x: 1 });
>f6 : Symbol(f6, Decl(destructuringWithLiteralInitializers.ts, 25, 19))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 31, 4))
f6({ y: 1 });
>f6 : Symbol(f6, Decl(destructuringWithLiteralInitializers.ts, 25, 19))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 32, 4))
f6({ x: 1, y: 1 });
>f6 : Symbol(f6, Decl(destructuringWithLiteralInitializers.ts, 25, 19))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 33, 4))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 33, 10))
// (arg?: { a: { x?: number, y?: number } }) => void
function f7({ a: { x = 0, y = 0 } } = { a: {} }) { }
>f7 : Symbol(f7, Decl(destructuringWithLiteralInitializers.ts, 33, 19))
>a : Symbol(a, Decl(destructuringWithLiteralInitializers.ts, 36, 39))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 36, 18))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 36, 25))
>a : Symbol(a, Decl(destructuringWithLiteralInitializers.ts, 36, 39))
f7();
>f7 : Symbol(f7, Decl(destructuringWithLiteralInitializers.ts, 33, 19))
f7({ a: {} });
>f7 : Symbol(f7, Decl(destructuringWithLiteralInitializers.ts, 33, 19))
>a : Symbol(a, Decl(destructuringWithLiteralInitializers.ts, 38, 4))
f7({ a: { x: 1 } });
>f7 : Symbol(f7, Decl(destructuringWithLiteralInitializers.ts, 33, 19))
>a : Symbol(a, Decl(destructuringWithLiteralInitializers.ts, 39, 4))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 39, 9))
f7({ a: { y: 1 } });
>f7 : Symbol(f7, Decl(destructuringWithLiteralInitializers.ts, 33, 19))
>a : Symbol(a, Decl(destructuringWithLiteralInitializers.ts, 40, 4))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 40, 9))
f7({ a: { x: 1, y: 1 } });
>f7 : Symbol(f7, Decl(destructuringWithLiteralInitializers.ts, 33, 19))
>a : Symbol(a, Decl(destructuringWithLiteralInitializers.ts, 41, 4))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 41, 9))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 41, 15))
// (arg: [any, any]) => void
function g1([x, y]) { }
>g1 : Symbol(g1, Decl(destructuringWithLiteralInitializers.ts, 41, 26))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 44, 13))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 44, 15))
g1([1, 1]);
>g1 : Symbol(g1, Decl(destructuringWithLiteralInitializers.ts, 41, 26))
// (arg: [number, number]) => void
function g2([x = 0, y = 0]) { }
>g2 : Symbol(g2, Decl(destructuringWithLiteralInitializers.ts, 45, 11))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 48, 13))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 48, 19))
g2([1, 1]);
>g2 : Symbol(g2, Decl(destructuringWithLiteralInitializers.ts, 45, 11))
// (arg?: [number, number]) => void
function g3([x, y] = [0, 0]) { }
>g3 : Symbol(g3, Decl(destructuringWithLiteralInitializers.ts, 49, 11))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 52, 13))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 52, 15))
g3();
>g3 : Symbol(g3, Decl(destructuringWithLiteralInitializers.ts, 49, 11))
g3([1, 1]);
>g3 : Symbol(g3, Decl(destructuringWithLiteralInitializers.ts, 49, 11))
// (arg?: [number, number]) => void
function g4([x, y = 0] = [0]) { }
>g4 : Symbol(g4, Decl(destructuringWithLiteralInitializers.ts, 54, 11))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 57, 13))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 57, 15))
g4();
>g4 : Symbol(g4, Decl(destructuringWithLiteralInitializers.ts, 54, 11))
g4([1, 1]);
>g4 : Symbol(g4, Decl(destructuringWithLiteralInitializers.ts, 54, 11))
// (arg?: [number, number]) => void
function g5([x = 0, y = 0] = []) { }
>g5 : Symbol(g5, Decl(destructuringWithLiteralInitializers.ts, 59, 11))
>x : Symbol(x, Decl(destructuringWithLiteralInitializers.ts, 62, 13))
>y : Symbol(y, Decl(destructuringWithLiteralInitializers.ts, 62, 19))
g5();
>g5 : Symbol(g5, Decl(destructuringWithLiteralInitializers.ts, 59, 11))
g5([1, 1]);
>g5 : Symbol(g5, Decl(destructuringWithLiteralInitializers.ts, 59, 11))
@@ -0,0 +1,310 @@
=== tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers.ts ===
// (arg: { x: any, y: any }) => void
function f1({ x, y }) { }
>f1 : ({ x, y }: { x: any; y: any; }) => void
>x : any
>y : any
f1({ x: 1, y: 1 });
>f1({ x: 1, y: 1 }) : void
>f1 : ({ x, y }: { x: any; y: any; }) => void
>{ x: 1, y: 1 } : { x: number; y: number; }
>x : number
>1 : number
>y : number
>1 : number
// (arg: { x: any, y?: number }) => void
function f2({ x, y = 0 }) { }
>f2 : ({ x, y = 0 }: { x: any; y?: number; }) => void
>x : any
>y : number
>0 : number
f2({ x: 1 });
>f2({ x: 1 }) : void
>f2 : ({ x, y = 0 }: { x: any; y?: number; }) => void
>{ x: 1 } : { x: number; }
>x : number
>1 : number
f2({ x: 1, y: 1 });
>f2({ x: 1, y: 1 }) : void
>f2 : ({ x, y = 0 }: { x: any; y?: number; }) => void
>{ x: 1, y: 1 } : { x: number; y: number; }
>x : number
>1 : number
>y : number
>1 : number
// (arg: { x?: number, y?: number }) => void
function f3({ x = 0, y = 0 }) { }
>f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void
>x : number
>0 : number
>y : number
>0 : number
f3({});
>f3({}) : void
>f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void
>{} : {}
f3({ x: 1 });
>f3({ x: 1 }) : void
>f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void
>{ x: 1 } : { x: number; }
>x : number
>1 : number
f3({ y: 1 });
>f3({ y: 1 }) : void
>f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void
>{ y: 1 } : { y: number; }
>y : number
>1 : number
f3({ x: 1, y: 1 });
>f3({ x: 1, y: 1 }) : void
>f3 : ({ x = 0, y = 0 }: { x?: number; y?: number; }) => void
>{ x: 1, y: 1 } : { x: number; y: number; }
>x : number
>1 : number
>y : number
>1 : number
// (arg?: { x: number, y: number }) => void
function f4({ x, y } = { x: 0, y: 0 }) { }
>f4 : ({ x, y }?: { x: number; y: number; }) => void
>x : number
>y : number
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>0 : number
>y : number
>0 : number
f4();
>f4() : void
>f4 : ({ x, y }?: { x: number; y: number; }) => void
f4({ x: 1, y: 1 });
>f4({ x: 1, y: 1 }) : void
>f4 : ({ x, y }?: { x: number; y: number; }) => void
>{ x: 1, y: 1 } : { x: number; y: number; }
>x : number
>1 : number
>y : number
>1 : number
// (arg?: { x: number, y?: number }) => void
function f5({ x, y = 0 } = { x: 0 }) { }
>f5 : ({ x, y = 0 }?: { x: number; y?: number; }) => void
>x : number
>y : number
>0 : number
>{ x: 0 } : { x: number; y?: number; }
>x : number
>0 : number
f5();
>f5() : void
>f5 : ({ x, y = 0 }?: { x: number; y?: number; }) => void
f5({ x: 1 });
>f5({ x: 1 }) : void
>f5 : ({ x, y = 0 }?: { x: number; y?: number; }) => void
>{ x: 1 } : { x: number; }
>x : number
>1 : number
f5({ x: 1, y: 1 });
>f5({ x: 1, y: 1 }) : void
>f5 : ({ x, y = 0 }?: { x: number; y?: number; }) => void
>{ x: 1, y: 1 } : { x: number; y: number; }
>x : number
>1 : number
>y : number
>1 : number
// (arg?: { x?: number, y?: number }) => void
function f6({ x = 0, y = 0 } = {}) { }
>f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void
>x : number
>0 : number
>y : number
>0 : number
>{} : { x?: number; y?: number; }
f6();
>f6() : void
>f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void
f6({});
>f6({}) : void
>f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void
>{} : {}
f6({ x: 1 });
>f6({ x: 1 }) : void
>f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void
>{ x: 1 } : { x: number; }
>x : number
>1 : number
f6({ y: 1 });
>f6({ y: 1 }) : void
>f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void
>{ y: 1 } : { y: number; }
>y : number
>1 : number
f6({ x: 1, y: 1 });
>f6({ x: 1, y: 1 }) : void
>f6 : ({ x = 0, y = 0 }?: { x?: number; y?: number; }) => void
>{ x: 1, y: 1 } : { x: number; y: number; }
>x : number
>1 : number
>y : number
>1 : number
// (arg?: { a: { x?: number, y?: number } }) => void
function f7({ a: { x = 0, y = 0 } } = { a: {} }) { }
>f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void
>a : any
>x : number
>0 : number
>y : number
>0 : number
>{ a: {} } : { a: { x?: number; y?: number; }; }
>a : { x?: number; y?: number; }
>{} : { x?: number; y?: number; }
f7();
>f7() : void
>f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void
f7({ a: {} });
>f7({ a: {} }) : void
>f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void
>{ a: {} } : { a: {}; }
>a : {}
>{} : {}
f7({ a: { x: 1 } });
>f7({ a: { x: 1 } }) : void
>f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void
>{ a: { x: 1 } } : { a: { x: number; }; }
>a : { x: number; }
>{ x: 1 } : { x: number; }
>x : number
>1 : number
f7({ a: { y: 1 } });
>f7({ a: { y: 1 } }) : void
>f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void
>{ a: { y: 1 } } : { a: { y: number; }; }
>a : { y: number; }
>{ y: 1 } : { y: number; }
>y : number
>1 : number
f7({ a: { x: 1, y: 1 } });
>f7({ a: { x: 1, y: 1 } }) : void
>f7 : ({ a: { x = 0, y = 0 } }?: { a: { x?: number; y?: number; }; }) => void
>{ a: { x: 1, y: 1 } } : { a: { x: number; y: number; }; }
>a : { x: number; y: number; }
>{ x: 1, y: 1 } : { x: number; y: number; }
>x : number
>1 : number
>y : number
>1 : number
// (arg: [any, any]) => void
function g1([x, y]) { }
>g1 : ([x, y]: [any, any]) => void
>x : any
>y : any
g1([1, 1]);
>g1([1, 1]) : void
>g1 : ([x, y]: [any, any]) => void
>[1, 1] : [number, number]
>1 : number
>1 : number
// (arg: [number, number]) => void
function g2([x = 0, y = 0]) { }
>g2 : ([x = 0, y = 0]: [number, number]) => void
>x : number
>0 : number
>y : number
>0 : number
g2([1, 1]);
>g2([1, 1]) : void
>g2 : ([x = 0, y = 0]: [number, number]) => void
>[1, 1] : [number, number]
>1 : number
>1 : number
// (arg?: [number, number]) => void
function g3([x, y] = [0, 0]) { }
>g3 : ([x, y]?: [number, number]) => void
>x : number
>y : number
>[0, 0] : [number, number]
>0 : number
>0 : number
g3();
>g3() : void
>g3 : ([x, y]?: [number, number]) => void
g3([1, 1]);
>g3([1, 1]) : void
>g3 : ([x, y]?: [number, number]) => void
>[1, 1] : [number, number]
>1 : number
>1 : number
// (arg?: [number, number]) => void
function g4([x, y = 0] = [0]) { }
>g4 : ([x, y = 0]?: [number, number]) => void
>x : number
>y : number
>0 : number
>[0] : [number, number]
>0 : number
g4();
>g4() : void
>g4 : ([x, y = 0]?: [number, number]) => void
g4([1, 1]);
>g4([1, 1]) : void
>g4 : ([x, y = 0]?: [number, number]) => void
>[1, 1] : [number, number]
>1 : number
>1 : number
// (arg?: [number, number]) => void
function g5([x = 0, y = 0] = []) { }
>g5 : ([x = 0, y = 0]?: [number, number]) => void
>x : number
>0 : number
>y : number
>0 : number
>[] : [number, number]
g5();
>g5() : void
>g5 : ([x = 0, y = 0]?: [number, number]) => void
g5([1, 1]);
>g5([1, 1]) : void
>g5 : ([x = 0, y = 0]?: [number, number]) => void
>[1, 1] : [number, number]
>1 : number
>1 : number
@@ -0,0 +1,33 @@
//// [doNotEmitDetachedComments.ts]
/*
multi line
comment
*/
var x = 10;
// Single Line comment
function foo() { }
/*
multi-line comment
*/
//========================
function bar() { }
//========================
//// [doNotEmitDetachedComments.js]
var x = 10;
function foo() { }
function bar() { }
@@ -0,0 +1,31 @@
=== tests/cases/compiler/doNotEmitDetachedComments.ts ===
/*
multi line
comment
*/
var x = 10;
>x : Symbol(x, Decl(doNotEmitDetachedComments.ts, 6, 3))
// Single Line comment
function foo() { }
>foo : Symbol(foo, Decl(doNotEmitDetachedComments.ts, 6, 11))
/*
multi-line comment
*/
//========================
function bar() { }
>bar : Symbol(bar, Decl(doNotEmitDetachedComments.ts, 10, 18))
//========================
@@ -0,0 +1,32 @@
=== tests/cases/compiler/doNotEmitDetachedComments.ts ===
/*
multi line
comment
*/
var x = 10;
>x : number
>10 : number
// Single Line comment
function foo() { }
>foo : () => void
/*
multi-line comment
*/
//========================
function bar() { }
>bar : () => void
//========================
@@ -0,0 +1,64 @@
//// [doNotEmitDetachedCommentsAtStartOfConstructor.ts]
class A {
constructor() {
// Single Line Comment
var x = 10;
}
}
class B {
constructor() {
/*
Multi-line comment
*/
var y = 10;
}
}
class C {
constructor() {
// Single Line Comment with more than one blank line
var x = 10;
}
}
class D {
constructor() {
/*
Multi-line comment with more than one blank line
*/
var y = 10;
}
}
//// [doNotEmitDetachedCommentsAtStartOfConstructor.js]
var A = (function () {
function A() {
var x = 10;
}
return A;
})();
var B = (function () {
function B() {
var y = 10;
}
return B;
})();
var C = (function () {
function C() {
var x = 10;
}
return C;
})();
var D = (function () {
function D() {
var y = 10;
}
return D;
})();
@@ -0,0 +1,50 @@
=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfConstructor.ts ===
class A {
>A : Symbol(A, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 0, 0))
constructor() {
// Single Line Comment
var x = 10;
>x : Symbol(x, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 4, 11))
}
}
class B {
>B : Symbol(B, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 6, 1))
constructor() {
/*
Multi-line comment
*/
var y = 10;
>y : Symbol(y, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 14, 11))
}
}
class C {
>C : Symbol(C, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 16, 1))
constructor() {
// Single Line Comment with more than one blank line
var x = 10;
>x : Symbol(x, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 23, 11))
}
}
class D {
>D : Symbol(D, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 25, 1))
constructor() {
/*
Multi-line comment with more than one blank line
*/
var y = 10;
>y : Symbol(y, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 34, 11))
}
}
@@ -0,0 +1,54 @@
=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfConstructor.ts ===
class A {
>A : A
constructor() {
// Single Line Comment
var x = 10;
>x : number
>10 : number
}
}
class B {
>B : B
constructor() {
/*
Multi-line comment
*/
var y = 10;
>y : number
>10 : number
}
}
class C {
>C : C
constructor() {
// Single Line Comment with more than one blank line
var x = 10;
>x : number
>10 : number
}
}
class D {
>D : D
constructor() {
/*
Multi-line comment with more than one blank line
*/
var y = 10;
>y : number
>10 : number
}
}
@@ -0,0 +1,48 @@
//// [doNotEmitDetachedCommentsAtStartOfFunctionBody.ts]
function foo1() {
// Single line comment
return 42;
}
function foo2() {
/*
multi line
comment
*/
return 42;
}
function foo3() {
// Single line comment with more than one blank line
return 42;
}
function foo4() {
/*
multi line comment with more than one blank line
*/
return 42;
}
//// [doNotEmitDetachedCommentsAtStartOfFunctionBody.js]
function foo1() {
return 42;
}
function foo2() {
return 42;
}
function foo3() {
return 42;
}
function foo4() {
return 42;
}
@@ -0,0 +1,42 @@
=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfFunctionBody.ts ===
function foo1() {
>foo1 : Symbol(foo1, Decl(doNotEmitDetachedCommentsAtStartOfFunctionBody.ts, 0, 0))
// Single line comment
return 42;
}
function foo2() {
>foo2 : Symbol(foo2, Decl(doNotEmitDetachedCommentsAtStartOfFunctionBody.ts, 4, 1))
/*
multi line
comment
*/
return 42;
}
function foo3() {
>foo3 : Symbol(foo3, Decl(doNotEmitDetachedCommentsAtStartOfFunctionBody.ts, 14, 1))
// Single line comment with more than one blank line
return 42;
}
function foo4() {
>foo4 : Symbol(foo4, Decl(doNotEmitDetachedCommentsAtStartOfFunctionBody.ts, 21, 1))
/*
multi line comment with more than one blank line
*/
return 42;
}
@@ -0,0 +1,46 @@
=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfFunctionBody.ts ===
function foo1() {
>foo1 : () => number
// Single line comment
return 42;
>42 : number
}
function foo2() {
>foo2 : () => number
/*
multi line
comment
*/
return 42;
>42 : number
}
function foo3() {
>foo3 : () => number
// Single line comment with more than one blank line
return 42;
>42 : number
}
function foo4() {
>foo4 : () => number
/*
multi line comment with more than one blank line
*/
return 42;
>42 : number
}
@@ -0,0 +1,45 @@
//// [doNotEmitDetachedCommentsAtStartOfLambdaFunction.ts]
() => {
// Single line comment
return 0;
}
() => {
/*
multi-line comment
*/
return 0;
}
() => {
// Single line comment with more than one blank line
return 0;
}
() => {
/*
multi-line comment with more than one blank line
*/
return 0;
}
//// [doNotEmitDetachedCommentsAtStartOfLambdaFunction.js]
(function () {
return 0;
});
(function () {
return 0;
});
(function () {
return 0;
});
(function () {
return 0;
});
@@ -0,0 +1,32 @@
=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfLambdaFunction.ts ===
() => {
No type information for this code. // Single line comment
No type information for this code.
No type information for this code. return 0;
No type information for this code.}
No type information for this code.
No type information for this code.() => {
No type information for this code. /*
No type information for this code. multi-line comment
No type information for this code. */
No type information for this code.
No type information for this code. return 0;
No type information for this code.}
No type information for this code.
No type information for this code.() => {
No type information for this code. // Single line comment with more than one blank line
No type information for this code.
No type information for this code.
No type information for this code. return 0;
No type information for this code.}
No type information for this code.
No type information for this code.() => {
No type information for this code. /*
No type information for this code. multi-line comment with more than one blank line
No type information for this code. */
No type information for this code.
No type information for this code.
No type information for this code. return 0;
No type information for this code.}
No type information for this code.
No type information for this code.
@@ -0,0 +1,43 @@
=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfLambdaFunction.ts ===
() => {
>() => { // Single line comment return 0;} : () => number
// Single line comment
return 0;
>0 : number
}
() => {
>() => { /* multi-line comment */ return 0;} : () => number
/*
multi-line comment
*/
return 0;
>0 : number
}
() => {
>() => { // Single line comment with more than one blank line return 0;} : () => number
// Single line comment with more than one blank line
return 0;
>0 : number
}
() => {
>() => { /* multi-line comment with more than one blank line */ return 0;} : () => number
/*
multi-line comment with more than one blank line
*/
return 0;
>0 : number
}
@@ -0,0 +1,14 @@
//// [doNotEmitPinnedCommentNotOnTopOfFile.ts]
var x = 10;
/*!
multi line
comment
*/
var x = 10;
//// [doNotEmitPinnedCommentNotOnTopOfFile.js]
var x = 10;
var x = 10;
@@ -0,0 +1,13 @@
=== tests/cases/compiler/doNotEmitPinnedCommentNotOnTopOfFile.ts ===
var x = 10;
>x : Symbol(x, Decl(doNotEmitPinnedCommentNotOnTopOfFile.ts, 0, 3), Decl(doNotEmitPinnedCommentNotOnTopOfFile.ts, 8, 3))
/*!
multi line
comment
*/
var x = 10;
>x : Symbol(x, Decl(doNotEmitPinnedCommentNotOnTopOfFile.ts, 0, 3), Decl(doNotEmitPinnedCommentNotOnTopOfFile.ts, 8, 3))
@@ -0,0 +1,15 @@
=== tests/cases/compiler/doNotEmitPinnedCommentNotOnTopOfFile.ts ===
var x = 10;
>x : number
>10 : number
/*!
multi line
comment
*/
var x = 10;
>x : number
>10 : number
@@ -0,0 +1,21 @@
//// [file1.ts]
class C {
/*! remove pinned comment anywhere else */
public foo(x: string, y: any)
public foo(x: string, y: number) { }
}
var x = 10;
/*! remove pinned comment anywhere else */
declare var OData: any;
//// [file1.js]
var C = (function () {
function C() {
}
C.prototype.foo = function (x, y) { };
return C;
})();
var x = 10;
@@ -0,0 +1,24 @@
=== tests/cases/compiler/file1.ts ===
class C {
>C : Symbol(C, Decl(file1.ts, 0, 0))
/*! remove pinned comment anywhere else */
public foo(x: string, y: any)
>foo : Symbol(foo, Decl(file1.ts, 1, 9), Decl(file1.ts, 3, 33))
>x : Symbol(x, Decl(file1.ts, 3, 15))
>y : Symbol(y, Decl(file1.ts, 3, 25))
public foo(x: string, y: number) { }
>foo : Symbol(foo, Decl(file1.ts, 1, 9), Decl(file1.ts, 3, 33))
>x : Symbol(x, Decl(file1.ts, 4, 15))
>y : Symbol(y, Decl(file1.ts, 4, 25))
}
var x = 10;
>x : Symbol(x, Decl(file1.ts, 7, 3))
/*! remove pinned comment anywhere else */
declare var OData: any;
>OData : Symbol(OData, Decl(file1.ts, 10, 11))
@@ -0,0 +1,25 @@
=== tests/cases/compiler/file1.ts ===
class C {
>C : C
/*! remove pinned comment anywhere else */
public foo(x: string, y: any)
>foo : (x: string, y: any) => any
>x : string
>y : any
public foo(x: string, y: number) { }
>foo : (x: string, y: any) => any
>x : string
>y : number
}
var x = 10;
>x : number
>10 : number
/*! remove pinned comment anywhere else */
declare var OData: any;
>OData : any
@@ -0,0 +1,18 @@
//// [doNotEmitPinnedCommentOnNotEmittedNodets.ts]
class C {
/*! remove pinned comment anywhere else */
public foo(x: string, y: any)
public foo(x: string, y: number) { }
}
/*! remove pinned comment anywhere else */
declare var OData: any;
//// [doNotEmitPinnedCommentOnNotEmittedNodets.js]
var C = (function () {
function C() {
}
C.prototype.foo = function (x, y) { };
return C;
})();
@@ -0,0 +1,21 @@
=== tests/cases/compiler/doNotEmitPinnedCommentOnNotEmittedNodets.ts ===
class C {
>C : Symbol(C, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 0, 0))
/*! remove pinned comment anywhere else */
public foo(x: string, y: any)
>foo : Symbol(foo, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 1, 9), Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 3, 33))
>x : Symbol(x, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 3, 15))
>y : Symbol(y, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 3, 25))
public foo(x: string, y: number) { }
>foo : Symbol(foo, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 1, 9), Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 3, 33))
>x : Symbol(x, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 4, 15))
>y : Symbol(y, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 4, 25))
}
/*! remove pinned comment anywhere else */
declare var OData: any;
>OData : Symbol(OData, Decl(doNotEmitPinnedCommentOnNotEmittedNodets.ts, 8, 11))
@@ -0,0 +1,21 @@
=== tests/cases/compiler/doNotEmitPinnedCommentOnNotEmittedNodets.ts ===
class C {
>C : C
/*! remove pinned comment anywhere else */
public foo(x: string, y: any)
>foo : (x: string, y: any) => any
>x : string
>y : any
public foo(x: string, y: number) { }
>foo : (x: string, y: any) => any
>x : string
>y : number
}
/*! remove pinned comment anywhere else */
declare var OData: any;
>OData : any
@@ -0,0 +1,42 @@
//// [doNotEmitPinnedDetachedComments.ts]
var x = 10;
/*! Single Line comment */
function baz() { }
/*!
multi-line comment
*/
//========================
function bar() {
/*!
Remove this comment
*/
}
function foo() {
/*! Remove this */
return 0;
}
//========================
//// [doNotEmitPinnedDetachedComments.js]
var x = 10;
function baz() { }
function bar() {
}
function foo() {
return 0;
}
@@ -0,0 +1,39 @@
=== tests/cases/compiler/doNotEmitPinnedDetachedComments.ts ===
var x = 10;
>x : Symbol(x, Decl(doNotEmitPinnedDetachedComments.ts, 0, 3))
/*! Single Line comment */
function baz() { }
>baz : Symbol(baz, Decl(doNotEmitPinnedDetachedComments.ts, 0, 11))
/*!
multi-line comment
*/
//========================
function bar() {
>bar : Symbol(bar, Decl(doNotEmitPinnedDetachedComments.ts, 4, 18))
/*!
Remove this comment
*/
}
function foo() {
>foo : Symbol(foo, Decl(doNotEmitPinnedDetachedComments.ts, 21, 1))
/*! Remove this */
return 0;
}
//========================
@@ -0,0 +1,41 @@
=== tests/cases/compiler/doNotEmitPinnedDetachedComments.ts ===
var x = 10;
>x : number
>10 : number
/*! Single Line comment */
function baz() { }
>baz : () => void
/*!
multi-line comment
*/
//========================
function bar() {
>bar : () => void
/*!
Remove this comment
*/
}
function foo() {
>foo : () => number
/*! Remove this */
return 0;
>0 : number
}
//========================
@@ -0,0 +1,15 @@
//// [tests/cases/compiler/doNotEmitTripleSlashCommentsInEmptyFile.ts] ////
//// [file0.ts]
//// [file1.ts]
//// [file2.ts]
/// <reference path="file0.ts" />
/// <reference path="file1.ts" />
/// <amd-dependency path="/js/libs/hgn.js!app/templates/home" name="compiler"/>
//// [file0.js]
//// [file1.js]
//// [file2.js]
@@ -0,0 +1,10 @@
=== tests/cases/compiler/file2.ts ===
/// <reference path="file0.ts" />
No type information for this code./// <reference path="file1.ts" />
No type information for this code./// <amd-dependency path="/js/libs/hgn.js!app/templates/home" name="compiler"/>
No type information for this code.=== tests/cases/compiler/file0.ts ===
No type information for this code.
No type information for this code.=== tests/cases/compiler/file1.ts ===
No type information for this code.
@@ -0,0 +1,10 @@
=== tests/cases/compiler/file2.ts ===
/// <reference path="file0.ts" />
No type information for this code./// <reference path="file1.ts" />
No type information for this code./// <amd-dependency path="/js/libs/hgn.js!app/templates/home" name="compiler"/>
No type information for this code.=== tests/cases/compiler/file0.ts ===
No type information for this code.
No type information for this code.=== tests/cases/compiler/file1.ts ===
No type information for this code.
@@ -0,0 +1,15 @@
//// [tests/cases/compiler/doNotEmitTripleSlashCommentsOnNotEmittedNode.ts] ////
//// [file0.ts]
/// <reference path="file1.ts" />
declare var OData: any;
//// [file1.ts]
/// <reference path="file0.ts" />
interface F { }
//// [file0.js]
//// [file1.js]
@@ -0,0 +1,12 @@
=== tests/cases/compiler/file1.ts ===
/// <reference path="file0.ts" />
interface F { }
>F : Symbol(F, Decl(file1.ts, 0, 0))
=== tests/cases/compiler/file0.ts ===
/// <reference path="file1.ts" />
declare var OData: any;
>OData : Symbol(OData, Decl(file0.ts, 2, 11))
@@ -0,0 +1,12 @@
=== tests/cases/compiler/file1.ts ===
/// <reference path="file0.ts" />
interface F { }
>F : F
=== tests/cases/compiler/file0.ts ===
/// <reference path="file1.ts" />
declare var OData: any;
>OData : any
@@ -0,0 +1,46 @@
//// [tests/cases/compiler/doNotemitTripleSlashComments.ts] ////
//// [file0.ts]
/// <reference path="file1.ts" />
/// <reference path="file2.ts" />
/// <amd-dependency path="/js/libs/hgn.js!app/templates/home" name="compiler"/>
var x = 10;
/// <reference path="file1.ts" />
var y = "hello";
/// <reference path="file2.ts" />
//// [file1.ts]
/// <reference path="file0.ts" />
function foo() { }
/// <reference path="file0.ts" />
var z = "world";
//// [file2.ts]
/// <reference path="file1.ts" />
/// ====================================
function bar() { }
//// [file0.js]
var x = 10;
var y = "hello";
//// [file1.js]
function foo() { }
var z = "world";
//// [file2.js]
function bar() { }
@@ -0,0 +1,40 @@
=== tests/cases/compiler/file2.ts ===
/// <reference path="file1.ts" />
/// ====================================
function bar() { }
>bar : Symbol(bar, Decl(file2.ts, 0, 0))
=== tests/cases/compiler/file0.ts ===
/// <reference path="file1.ts" />
/// <reference path="file2.ts" />
/// <amd-dependency path="/js/libs/hgn.js!app/templates/home" name="compiler"/>
var x = 10;
>x : Symbol(x, Decl(file0.ts, 4, 3))
/// <reference path="file1.ts" />
var y = "hello";
>y : Symbol(y, Decl(file0.ts, 7, 3))
/// <reference path="file2.ts" />
=== tests/cases/compiler/file1.ts ===
/// <reference path="file0.ts" />
function foo() { }
>foo : Symbol(foo, Decl(file1.ts, 0, 0))
/// <reference path="file0.ts" />
var z = "world";
>z : Symbol(z, Decl(file1.ts, 8, 3))
@@ -0,0 +1,43 @@
=== tests/cases/compiler/file2.ts ===
/// <reference path="file1.ts" />
/// ====================================
function bar() { }
>bar : () => void
=== tests/cases/compiler/file0.ts ===
/// <reference path="file1.ts" />
/// <reference path="file2.ts" />
/// <amd-dependency path="/js/libs/hgn.js!app/templates/home" name="compiler"/>
var x = 10;
>x : number
>10 : number
/// <reference path="file1.ts" />
var y = "hello";
>y : string
>"hello" : string
/// <reference path="file2.ts" />
=== tests/cases/compiler/file1.ts ===
/// <reference path="file0.ts" />
function foo() { }
>foo : () => void
/// <reference path="file0.ts" />
var z = "world";
>z : string
>"world" : string
@@ -0,0 +1,20 @@
tests/cases/compiler/downlevelLetConst12.ts(7,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/compiler/downlevelLetConst12.ts(10,8): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
==== tests/cases/compiler/downlevelLetConst12.ts (2 errors) ====
'use strict'
// top level let\const should not be renamed
let foo;
const bar = 1;
let [baz] = [];
~~~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
let {a: baz2} = { a: 1 };
const [baz3] = []
~~~~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
const {a: baz4} = { a: 1 };
@@ -1,26 +0,0 @@
=== tests/cases/compiler/downlevelLetConst12.ts ===
'use strict'
// top level let\const should not be renamed
let foo;
>foo : Symbol(foo, Decl(downlevelLetConst12.ts, 3, 3))
const bar = 1;
>bar : Symbol(bar, Decl(downlevelLetConst12.ts, 4, 5))
let [baz] = [];
>baz : Symbol(baz, Decl(downlevelLetConst12.ts, 6, 5))
let {a: baz2} = { a: 1 };
>a : Symbol(a, Decl(downlevelLetConst12.ts, 7, 17))
>baz2 : Symbol(baz2, Decl(downlevelLetConst12.ts, 7, 5))
>a : Symbol(a, Decl(downlevelLetConst12.ts, 7, 17))
const [baz3] = []
>baz3 : Symbol(baz3, Decl(downlevelLetConst12.ts, 9, 7))
const {a: baz4} = { a: 1 };
>a : Symbol(a, Decl(downlevelLetConst12.ts, 10, 19))
>baz4 : Symbol(baz4, Decl(downlevelLetConst12.ts, 10, 7))
>a : Symbol(a, Decl(downlevelLetConst12.ts, 10, 19))
@@ -1,35 +0,0 @@
=== tests/cases/compiler/downlevelLetConst12.ts ===
'use strict'
>'use strict' : string
// top level let\const should not be renamed
let foo;
>foo : any
const bar = 1;
>bar : number
>1 : number
let [baz] = [];
>baz : any
>[] : undefined[]
let {a: baz2} = { a: 1 };
>a : any
>baz2 : number
>{ a: 1 } : { a: number; }
>a : number
>1 : number
const [baz3] = []
>baz3 : any
>[] : undefined[]
const {a: baz4} = { a: 1 };
>a : any
>baz4 : number
>{ a: 1 } : { a: number; }
>a : number
>1 : number
@@ -1,10 +1,12 @@
tests/cases/compiler/downlevelLetConst16.ts(151,15): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/compiler/downlevelLetConst16.ts(164,17): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/compiler/downlevelLetConst16.ts(195,14): error TS2461: Type 'undefined' is not an array type.
tests/cases/compiler/downlevelLetConst16.ts(202,15): error TS2459: Type 'undefined' has no property 'a' and no string index signature.
tests/cases/compiler/downlevelLetConst16.ts(216,16): error TS2461: Type 'undefined' is not an array type.
tests/cases/compiler/downlevelLetConst16.ts(223,17): error TS2459: Type 'undefined' has no property 'a' and no string index signature.
==== tests/cases/compiler/downlevelLetConst16.ts (4 errors) ====
==== tests/cases/compiler/downlevelLetConst16.ts (6 errors) ====
'use strict'
declare function use(a: any);
@@ -156,6 +158,8 @@ tests/cases/compiler/downlevelLetConst16.ts(223,17): error TS2459: Type 'undefin
use(x);
}
for (let [y] = []; ;) {
~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
use(y);
}
for (let {a: z} = {a: 1}; ;) {
@@ -169,6 +173,8 @@ tests/cases/compiler/downlevelLetConst16.ts(223,17): error TS2459: Type 'undefin
use(x);
}
for (const [y] = []; ;) {
~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
use(y);
}
for (const {a: z} = { a: 1 }; ;) {
@@ -87,12 +87,12 @@ var p8 = ({ a = 1 }) => { };
>1 : number
var p9 = ({ a: { b = 1 } = { b: 1 } }) => { };
>p9 : ({ a: { b = 1 } = { b: 1 } }: { a?: { b: number; }; }) => void
>({ a: { b = 1 } = { b: 1 } }) => { } : ({ a: { b = 1 } = { b: 1 } }: { a?: { b: number; }; }) => void
>p9 : ({ a: { b = 1 } = { b: 1 } }: { a?: { b?: number; }; }) => void
>({ a: { b = 1 } = { b: 1 } }) => { } : ({ a: { b = 1 } = { b: 1 } }: { a?: { b?: number; }; }) => void
>a : any
>b : number
>1 : number
>{ b: 1 } : { b: number; }
>{ b: 1 } : { b?: number; }
>b : number
>1 : number
@@ -0,0 +1,16 @@
//// [emitPinnedCommentsOnTopOfFile.ts]
/*!
multi line
comment
*/
var x = 10;
//// [emitPinnedCommentsOnTopOfFile.js]
/*!
multi line
comment
*/
var x = 10;
@@ -0,0 +1,10 @@
=== tests/cases/compiler/emitPinnedCommentsOnTopOfFile.ts ===
/*!
multi line
comment
*/
var x = 10;
>x : Symbol(x, Decl(emitPinnedCommentsOnTopOfFile.ts, 6, 3))
@@ -0,0 +1,11 @@
=== tests/cases/compiler/emitPinnedCommentsOnTopOfFile.ts ===
/*!
multi line
comment
*/
var x = 10;
>x : number
>10 : number
@@ -0,0 +1,20 @@
//// [tests/cases/compiler/emitTopOfFileTripleSlashCommentOnNotEmittedNodeIfRemoveCommentsIsFalse.ts] ////
//// [file0.ts]
var x = 10
//// [file1.ts]
/// <reference path="file0.ts" />
declare var OData: any;
/// <reference path="file0.ts" />
interface F { }
//// [file0.js]
var x = 10;
//// [file1.js]
/// <reference path="file0.ts" />
Loaded 100 of 187 files, more files were not shown because too many files have changed in this diff. Show more