2015-03-26 01:36:47 +01:00
|
|
|
//// [iterableArrayPattern6.ts]
|
|
|
|
var a: Bar, b: string[];
|
|
|
|
[a, ...b] = new FooIterator;
|
|
|
|
class Bar { x }
|
|
|
|
class Foo extends Bar { y }
|
|
|
|
class FooIterator {
|
|
|
|
next() {
|
|
|
|
return {
|
|
|
|
value: new Foo,
|
|
|
|
done: false
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
[Symbol.iterator]() {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//// [iterableArrayPattern6.js]
|
|
|
|
var a, b;
|
2015-04-09 01:41:56 +02:00
|
|
|
[a, ...b] = new FooIterator;
|
2015-03-26 01:36:47 +01:00
|
|
|
class Bar {
|
|
|
|
}
|
|
|
|
class Foo extends Bar {
|
|
|
|
}
|
|
|
|
class FooIterator {
|
|
|
|
next() {
|
|
|
|
return {
|
|
|
|
value: new Foo,
|
|
|
|
done: false
|
|
|
|
};
|
|
|
|
}
|
|
|
|
[Symbol.iterator]() {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|