mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
22 lines
1.0 KiB
Plaintext
22 lines
1.0 KiB
Plaintext
generics4.ts(1,22): error TS2564: Property 'x' has no initializer and is not definitely assigned in the constructor.
|
|
generics4.ts(7,1): error TS2322: Type 'C<Y>' is not assignable to type 'C<X>'.
|
|
Type 'Y' is not assignable to type 'X'.
|
|
The types returned by 'f()' are incompatible between these types.
|
|
Type 'boolean' is not assignable to type 'string'.
|
|
|
|
|
|
==== generics4.ts (2 errors) ====
|
|
class C<T> { private x: T; }
|
|
~
|
|
!!! error TS2564: Property 'x' has no initializer and is not definitely assigned in the constructor.
|
|
interface X { f(): string; }
|
|
interface Y { f(): boolean; }
|
|
declare var a: C<X>;
|
|
declare var b: C<Y>;
|
|
|
|
a = b; // Not ok - return types of "f" are different
|
|
~
|
|
!!! error TS2322: Type 'C<Y>' is not assignable to type 'C<X>'.
|
|
!!! error TS2322: Type 'Y' is not assignable to type 'X'.
|
|
!!! error TS2322: The types returned by 'f()' are incompatible between these types.
|
|
!!! error TS2322: Type 'boolean' is not assignable to type 'string'. |