2018-05-03 23:00:52 +02:00
|
|
|
// @lib: es5
|
2015-12-11 20:00:55 +01:00
|
|
|
// @sourcemap: true
|
|
|
|
declare var console: {
|
|
|
|
log(msg: any): void;
|
|
|
|
}
|
|
|
|
type Robot = [number, string, string];
|
|
|
|
type MultiSkilledRobot = [string, string[]];
|
|
|
|
|
|
|
|
var robotA: Robot = [1, "mower", "mowing"];
|
|
|
|
var robotB: Robot = [2, "trimmer", "trimming"];
|
|
|
|
var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
|
|
|
|
var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
|
|
|
|
|
|
|
|
let nameA: string, numberB: number, nameB: string, skillB: string;
|
|
|
|
let robotAInfo: (number | string)[];
|
|
|
|
|
|
|
|
let multiSkillB: string[], nameMB: string, primarySkillB: string, secondarySkillB: string;
|
|
|
|
let multiRobotAInfo: (string | string[])[];
|
|
|
|
|
|
|
|
[, nameA = "helloNoName"] = robotA;
|
|
|
|
[, nameB = "helloNoName"] = getRobotB();
|
|
|
|
[, nameB = "helloNoName"] = [2, "trimmer", "trimming"];
|
|
|
|
[, multiSkillB = []] = multiRobotB;
|
|
|
|
[, multiSkillB = []] = getMultiRobotB();
|
2020-01-30 22:39:54 +01:00
|
|
|
[, multiSkillB = []] = ["roomba", ["vacuum", "mopping"]];
|
2015-12-11 20:00:55 +01:00
|
|
|
|
|
|
|
[numberB = -1] = robotB;
|
|
|
|
[numberB = -1] = getRobotB();
|
|
|
|
[numberB = -1] = [2, "trimmer", "trimming"];
|
|
|
|
[nameMB = "helloNoName"] = multiRobotB;
|
|
|
|
[nameMB = "helloNoName"] = getMultiRobotB();
|
|
|
|
[nameMB = "helloNoName"] = ["trimmer", ["trimming", "edging"]];
|
|
|
|
|
|
|
|
[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = robotB;
|
|
|
|
[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = getRobotB();
|
|
|
|
[numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = [2, "trimmer", "trimming"];
|
|
|
|
[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = multiRobotB;
|
|
|
|
[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = getMultiRobotB();
|
|
|
|
[nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] =
|
|
|
|
["trimmer", ["trimming", "edging"]];
|
|
|
|
|
|
|
|
[numberB = -1, ...robotAInfo] = robotB;
|
|
|
|
[numberB = -1, ...robotAInfo] = getRobotB();
|
|
|
|
[numberB = -1, ...robotAInfo] = <Robot>[2, "trimmer", "trimming"];
|
|
|
|
|
|
|
|
if (nameA == nameB) {
|
|
|
|
console.log(skillB);
|
|
|
|
}
|
|
|
|
|
|
|
|
function getRobotB() {
|
|
|
|
return robotB;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getMultiRobotB() {
|
|
|
|
return multiRobotB;
|
|
|
|
}
|