32 lines
No EOL
1.5 KiB
Text
32 lines
No EOL
1.5 KiB
Text
tests/cases/conformance/es6/for-ofStatements/for-of30.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 'return' are incompatible.
|
|
Type 'number' is not assignable to type '(value?: any) => IteratorResult<string>'.
|
|
|
|
|
|
==== tests/cases/conformance/es6/for-ofStatements/for-of30.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 'return' are incompatible.
|
|
!!! error TS2322: Type 'number' is not assignable to type '(value?: any) => IteratorResult<string>'.
|
|
|
|
class StringIterator {
|
|
next() {
|
|
return {
|
|
done: false,
|
|
value: ""
|
|
}
|
|
}
|
|
|
|
return = 0;
|
|
|
|
[Symbol.iterator]() {
|
|
return this;
|
|
}
|
|
} |