mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
34 lines
612 B
TypeScript
34 lines
612 B
TypeScript
//// [tests/cases/conformance/es6/for-ofStatements/for-of17.ts] ////
|
|
|
|
//// [for-of17.ts]
|
|
class NumberIterator {
|
|
next() {
|
|
return {
|
|
value: 0,
|
|
done: false
|
|
};
|
|
}
|
|
[Symbol.iterator]() {
|
|
return this;
|
|
}
|
|
}
|
|
|
|
var v: string;
|
|
for (v of new NumberIterator) { } // Should succeed
|
|
|
|
//// [for-of17.js]
|
|
"use strict";
|
|
class NumberIterator {
|
|
next() {
|
|
return {
|
|
value: 0,
|
|
done: false
|
|
};
|
|
}
|
|
[Symbol.iterator]() {
|
|
return this;
|
|
}
|
|
}
|
|
var v;
|
|
for (v of new NumberIterator) { } // Should succeed
|