2015-02-25 01:09:58 +01:00
|
|
|
tests/cases/conformance/es6/for-ofStatements/for-of31.ts(1,15): error TS2322: Type 'StringIterator' is not assignable to type 'Iterable<string>'.
|
|
|
|
Types of property '[Symbol.iterator]' are incompatible.
|
|
|
|
Type '() => StringIterator' is not assignable to type '() => Iterator<string>'.
|
|
|
|
Type 'StringIterator' is not assignable to type 'Iterator<string>'.
|
|
|
|
Types of property 'next' are incompatible.
|
2015-04-22 22:23:52 +02:00
|
|
|
Type '() => { value: string; }' is not assignable to type '(value?: any) => IteratorResult<string>'.
|
2015-02-25 01:09:58 +01:00
|
|
|
Type '{ value: string; }' is not assignable to type 'IteratorResult<string>'.
|
|
|
|
Property 'done' is missing in type '{ value: string; }'.
|
|
|
|
|
|
|
|
|
|
|
|
==== tests/cases/conformance/es6/for-ofStatements/for-of31.ts (1 errors) ====
|
|
|
|
for (var v of new StringIterator) { }
|
|
|
|
~~~~~~~~~~~~~~~~~~
|
|
|
|
!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterable<string>'.
|
|
|
|
!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible.
|
|
|
|
!!! error TS2322: Type '() => StringIterator' is not assignable to type '() => Iterator<string>'.
|
|
|
|
!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator<string>'.
|
|
|
|
!!! error TS2322: Types of property 'next' are incompatible.
|
2015-04-22 22:23:52 +02:00
|
|
|
!!! error TS2322: Type '() => { value: string; }' is not assignable to type '(value?: any) => IteratorResult<string>'.
|
2015-02-25 01:09:58 +01:00
|
|
|
!!! error TS2322: Type '{ value: string; }' is not assignable to type 'IteratorResult<string>'.
|
|
|
|
!!! error TS2322: Property 'done' is missing in type '{ value: string; }'.
|
|
|
|
|
|
|
|
class StringIterator {
|
|
|
|
next() {
|
|
|
|
return {
|
|
|
|
// no done property
|
|
|
|
value: ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
[Symbol.iterator]() {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|