mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-09 07:55:10 -05:00
Merge pull request #2874 from Microsoft/iteratorTypeFix
Fix Iterator type in es6.d.ts
This commit is contained in:
2
src/lib/es6.d.ts
vendored
2
src/lib/es6.d.ts
vendored
@@ -442,7 +442,7 @@ interface IteratorResult<T> {
|
||||
}
|
||||
|
||||
interface Iterator<T> {
|
||||
next(): IteratorResult<T>;
|
||||
next(value?: any): IteratorResult<T>;
|
||||
return?(value?: any): IteratorResult<T>;
|
||||
throw?(e?: any): IteratorResult<T>;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ tests/cases/conformance/es6/for-ofStatements/for-of31.ts(1,15): error TS2322: Ty
|
||||
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 '(value?: any) => IteratorResult<string>'.
|
||||
Type '{ value: string; }' is not assignable to type 'IteratorResult<string>'.
|
||||
Property 'done' is missing in type '{ value: string; }'.
|
||||
|
||||
@@ -16,7 +16,7 @@ tests/cases/conformance/es6/for-ofStatements/for-of31.ts(1,15): error TS2322: Ty
|
||||
!!! 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 '(value?: any) => IteratorResult<string>'.
|
||||
!!! error TS2322: Type '{ value: string; }' is not assignable to type 'IteratorResult<string>'.
|
||||
!!! error TS2322: Property 'done' is missing in type '{ value: string; }'.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts(1,17): error TS2322
|
||||
Type '() => SymbolIterator' is not assignable to type '() => Iterator<symbol>'.
|
||||
Type 'SymbolIterator' is not assignable to type 'Iterator<symbol>'.
|
||||
Types of property 'next' are incompatible.
|
||||
Type '() => { value: symbol; }' is not assignable to type '() => IteratorResult<symbol>'.
|
||||
Type '() => { value: symbol; }' is not assignable to type '(value?: any) => IteratorResult<symbol>'.
|
||||
Type '{ value: symbol; }' is not assignable to type 'IteratorResult<symbol>'.
|
||||
Property 'done' is missing in type '{ value: symbol; }'.
|
||||
|
||||
@@ -16,7 +16,7 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts(1,17): error TS2322
|
||||
!!! error TS2322: Type '() => SymbolIterator' is not assignable to type '() => Iterator<symbol>'.
|
||||
!!! error TS2322: Type 'SymbolIterator' is not assignable to type 'Iterator<symbol>'.
|
||||
!!! error TS2322: Types of property 'next' are incompatible.
|
||||
!!! error TS2322: Type '() => { value: symbol; }' is not assignable to type '() => IteratorResult<symbol>'.
|
||||
!!! error TS2322: Type '() => { value: symbol; }' is not assignable to type '(value?: any) => IteratorResult<symbol>'.
|
||||
!!! error TS2322: Type '{ value: symbol; }' is not assignable to type 'IteratorResult<symbol>'.
|
||||
!!! error TS2322: Property 'done' is missing in type '{ value: symbol; }'.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user