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