TypeScript/tests/baselines/reference/generatorTypeCheck25.errors.txt
2015-05-04 16:15:55 -07:00

36 lines
2.4 KiB
Plaintext

tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck25.ts(4,5): error TS2322: Type '() => IterableIterator<Bar | Baz>' is not assignable to type '() => Iterable<Foo>'.
Type 'IterableIterator<Bar | Baz>' is not assignable to type 'Iterable<Foo>'.
Types of property '[Symbol.iterator]' are incompatible.
Type '() => IterableIterator<Bar | Baz>' is not assignable to type '() => Iterator<Foo>'.
Type 'IterableIterator<Bar | Baz>' is not assignable to type 'Iterator<Foo>'.
Types of property 'next' are incompatible.
Type '(value?: any) => IteratorResult<Bar | Baz>' is not assignable to type '(value?: any) => IteratorResult<Foo>'.
Type 'IteratorResult<Bar | Baz>' is not assignable to type 'IteratorResult<Foo>'.
Type 'Bar | Baz' is not assignable to type 'Foo'.
Type 'Baz' is not assignable to type 'Foo'.
Property 'x' is missing in type 'Baz'.
==== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck25.ts (1 errors) ====
class Foo { x: number }
class Bar extends Foo { y: string }
class Baz { z: number }
var g3: () => Iterable<Foo> = function* () {
~~
!!! error TS2322: Type '() => IterableIterator<Bar | Baz>' is not assignable to type '() => Iterable<Foo>'.
!!! error TS2322: Type 'IterableIterator<Bar | Baz>' is not assignable to type 'Iterable<Foo>'.
!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible.
!!! error TS2322: Type '() => IterableIterator<Bar | Baz>' is not assignable to type '() => Iterator<Foo>'.
!!! error TS2322: Type 'IterableIterator<Bar | Baz>' is not assignable to type 'Iterator<Foo>'.
!!! error TS2322: Types of property 'next' are incompatible.
!!! error TS2322: Type '(value?: any) => IteratorResult<Bar | Baz>' is not assignable to type '(value?: any) => IteratorResult<Foo>'.
!!! error TS2322: Type 'IteratorResult<Bar | Baz>' is not assignable to type 'IteratorResult<Foo>'.
!!! error TS2322: Type 'Bar | Baz' is not assignable to type 'Foo'.
!!! error TS2322: Type 'Baz' is not assignable to type 'Foo'.
!!! error TS2322: Property 'x' is missing in type 'Baz'.
yield;
yield new Bar;
yield new Baz;
yield *[new Bar];
yield *[new Baz];
}