Merge pull request #2874 from Microsoft/iteratorTypeFix

Fix Iterator type in es6.d.ts
This commit is contained in:
Jason Freeman
2015-04-22 14:48:15 -07:00
3 changed files with 5 additions and 5 deletions

2
src/lib/es6.d.ts vendored
View File

@@ -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>;
}

View File

@@ -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; }'.

View File

@@ -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; }'.