mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-09 16:23:55 -05:00
Test cases for variable statement with array binding pattern
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts]
|
||||
declare var console: {
|
||||
log(msg: string): void;
|
||||
}
|
||||
type Robot = [number, string, string];
|
||||
var robotA: Robot = [1, "mower", "mowing"];
|
||||
var robotB: Robot = [2, "trimmer", "trimming"];
|
||||
|
||||
|
||||
let [, nameA] = robotA;
|
||||
let [numberB] = robotB;
|
||||
let [numberA2, nameA2, skillA2] = robotA;
|
||||
|
||||
let [numberC2] = [3, "edging", "Trimming edges"];
|
||||
let [numberC, nameC, skillC] = [3, "edging", "Trimming edges"];
|
||||
|
||||
let [numberA3, ...robotAInfo] = robotA;
|
||||
|
||||
if (nameA == nameA2) {
|
||||
console.log(skillA2);
|
||||
}
|
||||
|
||||
//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js]
|
||||
var robotA = [1, "mower", "mowing"];
|
||||
var robotB = [2, "trimmer", "trimming"];
|
||||
var nameA = robotA[1];
|
||||
var numberB = robotB[0];
|
||||
var numberA2 = robotA[0], nameA2 = robotA[1], skillA2 = robotA[2];
|
||||
var numberC2 = [3, "edging", "Trimming edges"][0];
|
||||
var _a = [3, "edging", "Trimming edges"], numberC = _a[0], nameC = _a[1], skillC = _a[2];
|
||||
var numberA3 = robotA[0], robotAInfo = robotA.slice(1);
|
||||
if (nameA == nameA2) {
|
||||
console.log(skillA2);
|
||||
}
|
||||
//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js.map
|
||||
@@ -0,0 +1,2 @@
|
||||
//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js.map]
|
||||
{"version":3,"file":"sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts"],"names":[],"mappings":"AAIA,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC3C,IAAI,MAAM,GAAU,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAG/C,IAAO,iBAAK,CAAW;AACvB,IAAI,mBAAkB,CAAC;AACvB,IAAK,oBAAQ,EAAE,kBAAM,EAAE,mBAAO,CAAW;AAEzC,IAAI,6CAA4C,CAAC;AACjD,IAA+B,oCAA+B,EAAzD,eAAO,EAAE,aAAK,EAAE,cAAM,CAAoC;AAE/D,IAAK,oBAAQ,EAAE,4BAAa,CAAW;AAEvC,EAAE,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC;IAClB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC"}
|
||||
@@ -0,0 +1,298 @@
|
||||
===================================================================
|
||||
JsFile: sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js
|
||||
mapUrl: sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js.map
|
||||
sourceRoot:
|
||||
sources: sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js
|
||||
sourceFile:sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>var robotA = [1, "mower", "mowing"];
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^^^^^^
|
||||
4 > ^^^
|
||||
5 > ^
|
||||
6 > ^
|
||||
7 > ^^
|
||||
8 > ^^^^^^^
|
||||
9 > ^^
|
||||
10> ^^^^^^^^
|
||||
11> ^
|
||||
12> ^
|
||||
13> ^^^^^->
|
||||
1 >declare var console: {
|
||||
> log(msg: string): void;
|
||||
>}
|
||||
>type Robot = [number, string, string];
|
||||
>
|
||||
2 >var
|
||||
3 > robotA
|
||||
4 > : Robot =
|
||||
5 > [
|
||||
6 > 1
|
||||
7 > ,
|
||||
8 > "mower"
|
||||
9 > ,
|
||||
10> "mowing"
|
||||
11> ]
|
||||
12> ;
|
||||
1 >Emitted(1, 1) Source(5, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 5) Source(5, 5) + SourceIndex(0)
|
||||
3 >Emitted(1, 11) Source(5, 11) + SourceIndex(0)
|
||||
4 >Emitted(1, 14) Source(5, 21) + SourceIndex(0)
|
||||
5 >Emitted(1, 15) Source(5, 22) + SourceIndex(0)
|
||||
6 >Emitted(1, 16) Source(5, 23) + SourceIndex(0)
|
||||
7 >Emitted(1, 18) Source(5, 25) + SourceIndex(0)
|
||||
8 >Emitted(1, 25) Source(5, 32) + SourceIndex(0)
|
||||
9 >Emitted(1, 27) Source(5, 34) + SourceIndex(0)
|
||||
10>Emitted(1, 35) Source(5, 42) + SourceIndex(0)
|
||||
11>Emitted(1, 36) Source(5, 43) + SourceIndex(0)
|
||||
12>Emitted(1, 37) Source(5, 44) + SourceIndex(0)
|
||||
---
|
||||
>>>var robotB = [2, "trimmer", "trimming"];
|
||||
1->
|
||||
2 >^^^^
|
||||
3 > ^^^^^^
|
||||
4 > ^^^
|
||||
5 > ^
|
||||
6 > ^
|
||||
7 > ^^
|
||||
8 > ^^^^^^^^^
|
||||
9 > ^^
|
||||
10> ^^^^^^^^^^
|
||||
11> ^
|
||||
12> ^
|
||||
1->
|
||||
>
|
||||
2 >var
|
||||
3 > robotB
|
||||
4 > : Robot =
|
||||
5 > [
|
||||
6 > 2
|
||||
7 > ,
|
||||
8 > "trimmer"
|
||||
9 > ,
|
||||
10> "trimming"
|
||||
11> ]
|
||||
12> ;
|
||||
1->Emitted(2, 1) Source(6, 1) + SourceIndex(0)
|
||||
2 >Emitted(2, 5) Source(6, 5) + SourceIndex(0)
|
||||
3 >Emitted(2, 11) Source(6, 11) + SourceIndex(0)
|
||||
4 >Emitted(2, 14) Source(6, 21) + SourceIndex(0)
|
||||
5 >Emitted(2, 15) Source(6, 22) + SourceIndex(0)
|
||||
6 >Emitted(2, 16) Source(6, 23) + SourceIndex(0)
|
||||
7 >Emitted(2, 18) Source(6, 25) + SourceIndex(0)
|
||||
8 >Emitted(2, 27) Source(6, 34) + SourceIndex(0)
|
||||
9 >Emitted(2, 29) Source(6, 36) + SourceIndex(0)
|
||||
10>Emitted(2, 39) Source(6, 46) + SourceIndex(0)
|
||||
11>Emitted(2, 40) Source(6, 47) + SourceIndex(0)
|
||||
12>Emitted(2, 41) Source(6, 48) + SourceIndex(0)
|
||||
---
|
||||
>>>var nameA = robotA[1];
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^^^^^^^^^^^^^^^^^
|
||||
4 > ^
|
||||
5 > ^^^->
|
||||
1 >
|
||||
>
|
||||
>
|
||||
>
|
||||
2 >let [,
|
||||
3 > nameA
|
||||
4 > ] = robotA;
|
||||
1 >Emitted(3, 1) Source(9, 1) + SourceIndex(0)
|
||||
2 >Emitted(3, 5) Source(9, 8) + SourceIndex(0)
|
||||
3 >Emitted(3, 22) Source(9, 13) + SourceIndex(0)
|
||||
4 >Emitted(3, 23) Source(9, 24) + SourceIndex(0)
|
||||
---
|
||||
>>>var numberB = robotB[0];
|
||||
1->
|
||||
2 >^^^^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^
|
||||
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
2 >let
|
||||
3 > [numberB] = robotB
|
||||
4 > ;
|
||||
1->Emitted(4, 1) Source(10, 1) + SourceIndex(0)
|
||||
2 >Emitted(4, 5) Source(10, 5) + SourceIndex(0)
|
||||
3 >Emitted(4, 24) Source(10, 23) + SourceIndex(0)
|
||||
4 >Emitted(4, 25) Source(10, 24) + SourceIndex(0)
|
||||
---
|
||||
>>>var numberA2 = robotA[0], nameA2 = robotA[1], skillA2 = robotA[2];
|
||||
1->
|
||||
2 >^^^^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^^
|
||||
5 > ^^^^^^^^^^^^^^^^^^
|
||||
6 > ^^
|
||||
7 > ^^^^^^^^^^^^^^^^^^^
|
||||
8 > ^
|
||||
1->
|
||||
>
|
||||
2 >let [
|
||||
3 > numberA2
|
||||
4 > ,
|
||||
5 > nameA2
|
||||
6 > ,
|
||||
7 > skillA2
|
||||
8 > ] = robotA;
|
||||
1->Emitted(5, 1) Source(11, 1) + SourceIndex(0)
|
||||
2 >Emitted(5, 5) Source(11, 6) + SourceIndex(0)
|
||||
3 >Emitted(5, 25) Source(11, 14) + SourceIndex(0)
|
||||
4 >Emitted(5, 27) Source(11, 16) + SourceIndex(0)
|
||||
5 >Emitted(5, 45) Source(11, 22) + SourceIndex(0)
|
||||
6 >Emitted(5, 47) Source(11, 24) + SourceIndex(0)
|
||||
7 >Emitted(5, 66) Source(11, 31) + SourceIndex(0)
|
||||
8 >Emitted(5, 67) Source(11, 42) + SourceIndex(0)
|
||||
---
|
||||
>>>var numberC2 = [3, "edging", "Trimming edges"][0];
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^
|
||||
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
>
|
||||
2 >let
|
||||
3 > [numberC2] = [3, "edging", "Trimming edges"]
|
||||
4 > ;
|
||||
1 >Emitted(6, 1) Source(13, 1) + SourceIndex(0)
|
||||
2 >Emitted(6, 5) Source(13, 5) + SourceIndex(0)
|
||||
3 >Emitted(6, 50) Source(13, 49) + SourceIndex(0)
|
||||
4 >Emitted(6, 51) Source(13, 50) + SourceIndex(0)
|
||||
---
|
||||
>>>var _a = [3, "edging", "Trimming edges"], numberC = _a[0], nameC = _a[1], skillC = _a[2];
|
||||
1->
|
||||
2 >^^^^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^^
|
||||
5 > ^^^^^^^^^^^^^^^
|
||||
6 > ^^
|
||||
7 > ^^^^^^^^^^^^^
|
||||
8 > ^^
|
||||
9 > ^^^^^^^^^^^^^^
|
||||
10> ^
|
||||
1->
|
||||
>
|
||||
2 >let [numberC, nameC, skillC] =
|
||||
3 > [3, "edging", "Trimming edges"]
|
||||
4 >
|
||||
5 > numberC
|
||||
6 > ,
|
||||
7 > nameC
|
||||
8 > ,
|
||||
9 > skillC
|
||||
10> ] = [3, "edging", "Trimming edges"];
|
||||
1->Emitted(7, 1) Source(14, 1) + SourceIndex(0)
|
||||
2 >Emitted(7, 5) Source(14, 32) + SourceIndex(0)
|
||||
3 >Emitted(7, 41) Source(14, 63) + SourceIndex(0)
|
||||
4 >Emitted(7, 43) Source(14, 6) + SourceIndex(0)
|
||||
5 >Emitted(7, 58) Source(14, 13) + SourceIndex(0)
|
||||
6 >Emitted(7, 60) Source(14, 15) + SourceIndex(0)
|
||||
7 >Emitted(7, 73) Source(14, 20) + SourceIndex(0)
|
||||
8 >Emitted(7, 75) Source(14, 22) + SourceIndex(0)
|
||||
9 >Emitted(7, 89) Source(14, 28) + SourceIndex(0)
|
||||
10>Emitted(7, 90) Source(14, 64) + SourceIndex(0)
|
||||
---
|
||||
>>>var numberA3 = robotA[0], robotAInfo = robotA.slice(1);
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^^
|
||||
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
6 > ^
|
||||
1 >
|
||||
>
|
||||
>
|
||||
2 >let [
|
||||
3 > numberA3
|
||||
4 > ,
|
||||
5 > ...robotAInfo
|
||||
6 > ] = robotA;
|
||||
1 >Emitted(8, 1) Source(16, 1) + SourceIndex(0)
|
||||
2 >Emitted(8, 5) Source(16, 6) + SourceIndex(0)
|
||||
3 >Emitted(8, 25) Source(16, 14) + SourceIndex(0)
|
||||
4 >Emitted(8, 27) Source(16, 16) + SourceIndex(0)
|
||||
5 >Emitted(8, 55) Source(16, 29) + SourceIndex(0)
|
||||
6 >Emitted(8, 56) Source(16, 40) + SourceIndex(0)
|
||||
---
|
||||
>>>if (nameA == nameA2) {
|
||||
1 >
|
||||
2 >^^
|
||||
3 > ^
|
||||
4 > ^
|
||||
5 > ^^^^^
|
||||
6 > ^^^^
|
||||
7 > ^^^^^^
|
||||
8 > ^
|
||||
9 > ^
|
||||
10> ^
|
||||
11> ^^^^->
|
||||
1 >
|
||||
>
|
||||
>
|
||||
2 >if
|
||||
3 >
|
||||
4 > (
|
||||
5 > nameA
|
||||
6 > ==
|
||||
7 > nameA2
|
||||
8 > )
|
||||
9 >
|
||||
10> {
|
||||
1 >Emitted(9, 1) Source(18, 1) + SourceIndex(0)
|
||||
2 >Emitted(9, 3) Source(18, 3) + SourceIndex(0)
|
||||
3 >Emitted(9, 4) Source(18, 4) + SourceIndex(0)
|
||||
4 >Emitted(9, 5) Source(18, 5) + SourceIndex(0)
|
||||
5 >Emitted(9, 10) Source(18, 10) + SourceIndex(0)
|
||||
6 >Emitted(9, 14) Source(18, 14) + SourceIndex(0)
|
||||
7 >Emitted(9, 20) Source(18, 20) + SourceIndex(0)
|
||||
8 >Emitted(9, 21) Source(18, 21) + SourceIndex(0)
|
||||
9 >Emitted(9, 22) Source(18, 22) + SourceIndex(0)
|
||||
10>Emitted(9, 23) Source(18, 23) + SourceIndex(0)
|
||||
---
|
||||
>>> console.log(skillA2);
|
||||
1->^^^^
|
||||
2 > ^^^^^^^
|
||||
3 > ^
|
||||
4 > ^^^
|
||||
5 > ^
|
||||
6 > ^^^^^^^
|
||||
7 > ^
|
||||
8 > ^
|
||||
1->
|
||||
>
|
||||
2 > console
|
||||
3 > .
|
||||
4 > log
|
||||
5 > (
|
||||
6 > skillA2
|
||||
7 > )
|
||||
8 > ;
|
||||
1->Emitted(10, 5) Source(19, 5) + SourceIndex(0)
|
||||
2 >Emitted(10, 12) Source(19, 12) + SourceIndex(0)
|
||||
3 >Emitted(10, 13) Source(19, 13) + SourceIndex(0)
|
||||
4 >Emitted(10, 16) Source(19, 16) + SourceIndex(0)
|
||||
5 >Emitted(10, 17) Source(19, 17) + SourceIndex(0)
|
||||
6 >Emitted(10, 24) Source(19, 24) + SourceIndex(0)
|
||||
7 >Emitted(10, 25) Source(19, 25) + SourceIndex(0)
|
||||
8 >Emitted(10, 26) Source(19, 26) + SourceIndex(0)
|
||||
---
|
||||
>>>}
|
||||
1 >
|
||||
2 >^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 >}
|
||||
1 >Emitted(11, 1) Source(20, 1) + SourceIndex(0)
|
||||
2 >Emitted(11, 2) Source(20, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern.js.map
|
||||
@@ -0,0 +1,57 @@
|
||||
=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts ===
|
||||
declare var console: {
|
||||
>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 0, 11))
|
||||
|
||||
log(msg: string): void;
|
||||
>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 0, 22))
|
||||
>msg : Symbol(msg, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 1, 8))
|
||||
}
|
||||
type Robot = [number, string, string];
|
||||
>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 2, 1))
|
||||
|
||||
var robotA: Robot = [1, "mower", "mowing"];
|
||||
>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 4, 3))
|
||||
>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 2, 1))
|
||||
|
||||
var robotB: Robot = [2, "trimmer", "trimming"];
|
||||
>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 5, 3))
|
||||
>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 2, 1))
|
||||
|
||||
|
||||
let [, nameA] = robotA;
|
||||
>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 8, 6))
|
||||
>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 4, 3))
|
||||
|
||||
let [numberB] = robotB;
|
||||
>numberB : Symbol(numberB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 9, 5))
|
||||
>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 5, 3))
|
||||
|
||||
let [numberA2, nameA2, skillA2] = robotA;
|
||||
>numberA2 : Symbol(numberA2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 10, 5))
|
||||
>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 10, 14))
|
||||
>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 10, 22))
|
||||
>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 4, 3))
|
||||
|
||||
let [numberC2] = [3, "edging", "Trimming edges"];
|
||||
>numberC2 : Symbol(numberC2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 12, 5))
|
||||
|
||||
let [numberC, nameC, skillC] = [3, "edging", "Trimming edges"];
|
||||
>numberC : Symbol(numberC, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 13, 5))
|
||||
>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 13, 13))
|
||||
>skillC : Symbol(skillC, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 13, 20))
|
||||
|
||||
let [numberA3, ...robotAInfo] = robotA;
|
||||
>numberA3 : Symbol(numberA3, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 15, 5))
|
||||
>robotAInfo : Symbol(robotAInfo, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 15, 14))
|
||||
>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 4, 3))
|
||||
|
||||
if (nameA == nameA2) {
|
||||
>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 8, 6))
|
||||
>nameA2 : Symbol(nameA2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 10, 14))
|
||||
|
||||
console.log(skillA2);
|
||||
>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 0, 22))
|
||||
>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 0, 11))
|
||||
>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 0, 22))
|
||||
>skillA2 : Symbol(skillA2, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts, 10, 22))
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts ===
|
||||
declare var console: {
|
||||
>console : { log(msg: string): void; }
|
||||
|
||||
log(msg: string): void;
|
||||
>log : (msg: string) => void
|
||||
>msg : string
|
||||
}
|
||||
type Robot = [number, string, string];
|
||||
>Robot : [number, string, string]
|
||||
|
||||
var robotA: Robot = [1, "mower", "mowing"];
|
||||
>robotA : [number, string, string]
|
||||
>Robot : [number, string, string]
|
||||
>[1, "mower", "mowing"] : [number, string, string]
|
||||
>1 : number
|
||||
>"mower" : string
|
||||
>"mowing" : string
|
||||
|
||||
var robotB: Robot = [2, "trimmer", "trimming"];
|
||||
>robotB : [number, string, string]
|
||||
>Robot : [number, string, string]
|
||||
>[2, "trimmer", "trimming"] : [number, string, string]
|
||||
>2 : number
|
||||
>"trimmer" : string
|
||||
>"trimming" : string
|
||||
|
||||
|
||||
let [, nameA] = robotA;
|
||||
> : undefined
|
||||
>nameA : string
|
||||
>robotA : [number, string, string]
|
||||
|
||||
let [numberB] = robotB;
|
||||
>numberB : number
|
||||
>robotB : [number, string, string]
|
||||
|
||||
let [numberA2, nameA2, skillA2] = robotA;
|
||||
>numberA2 : number
|
||||
>nameA2 : string
|
||||
>skillA2 : string
|
||||
>robotA : [number, string, string]
|
||||
|
||||
let [numberC2] = [3, "edging", "Trimming edges"];
|
||||
>numberC2 : number
|
||||
>[3, "edging", "Trimming edges"] : [number, string, string]
|
||||
>3 : number
|
||||
>"edging" : string
|
||||
>"Trimming edges" : string
|
||||
|
||||
let [numberC, nameC, skillC] = [3, "edging", "Trimming edges"];
|
||||
>numberC : number
|
||||
>nameC : string
|
||||
>skillC : string
|
||||
>[3, "edging", "Trimming edges"] : [number, string, string]
|
||||
>3 : number
|
||||
>"edging" : string
|
||||
>"Trimming edges" : string
|
||||
|
||||
let [numberA3, ...robotAInfo] = robotA;
|
||||
>numberA3 : number
|
||||
>robotAInfo : (number | string)[]
|
||||
>robotA : [number, string, string]
|
||||
|
||||
if (nameA == nameA2) {
|
||||
>nameA == nameA2 : boolean
|
||||
>nameA : string
|
||||
>nameA2 : string
|
||||
|
||||
console.log(skillA2);
|
||||
>console.log(skillA2) : void
|
||||
>console.log : (msg: string) => void
|
||||
>console : { log(msg: string): void; }
|
||||
>log : (msg: string) => void
|
||||
>skillA2 : string
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// @sourcemap: true
|
||||
declare var console: {
|
||||
log(msg: string): void;
|
||||
}
|
||||
type Robot = [number, string, string];
|
||||
var robotA: Robot = [1, "mower", "mowing"];
|
||||
var robotB: Robot = [2, "trimmer", "trimming"];
|
||||
|
||||
|
||||
let [, nameA] = robotA;
|
||||
let [numberB] = robotB;
|
||||
let [numberA2, nameA2, skillA2] = robotA;
|
||||
|
||||
let [numberC2] = [3, "edging", "Trimming edges"];
|
||||
let [numberC, nameC, skillC] = [3, "edging", "Trimming edges"];
|
||||
|
||||
let [numberA3, ...robotAInfo] = robotA;
|
||||
|
||||
if (nameA == nameA2) {
|
||||
console.log(skillA2);
|
||||
}
|
||||
Reference in New Issue
Block a user