34 lines
No EOL
1.8 KiB
Text
34 lines
No EOL
1.8 KiB
Text
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.
|
|
Type '() => { value: string; }' is not assignable to type '() => IteratorResult<string>'.
|
|
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.
|
|
!!! error TS2322: Type '() => { value: string; }' is not assignable to type '() => IteratorResult<string>'.
|
|
!!! 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;
|
|
}
|
|
} |