mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-27 23:58:38 -06:00
Fix Iterator type in es6.d.ts
This commit is contained in:
parent
5edb5cdfc7
commit
4dc9da255f
4
src/lib/es6.d.ts
vendored
4
src/lib/es6.d.ts
vendored
@ -442,8 +442,8 @@ interface IteratorResult<T> {
|
||||
}
|
||||
|
||||
interface Iterator<T> {
|
||||
next(): IteratorResult<T>;
|
||||
return?(value?: any): IteratorResult<T>;
|
||||
next(value?: any): IteratorResult<T>;
|
||||
return?(value?: T): IteratorResult<T>;
|
||||
throw?(e?: any): IteratorResult<T>;
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ tests/cases/conformance/es6/for-ofStatements/for-of30.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 'return' are incompatible.
|
||||
Type 'number' is not assignable to type '(value?: any) => IteratorResult<string>'.
|
||||
Type 'number' is not assignable to type '(value?: string) => IteratorResult<string>'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/for-ofStatements/for-of30.ts (1 errors) ====
|
||||
@ -14,7 +14,7 @@ tests/cases/conformance/es6/for-ofStatements/for-of30.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 'return' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type '(value?: any) => IteratorResult<string>'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type '(value?: string) => IteratorResult<string>'.
|
||||
|
||||
class StringIterator {
|
||||
next() {
|
||||
|
||||
@ -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; }'.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user