mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
127 lines
7.4 KiB
Plaintext
127 lines
7.4 KiB
Plaintext
assignmentCompatWithConstructSignatures5.ts(3,14): error TS2564: Property 'foo' has no initializer and is not definitely assigned in the constructor.
|
|
assignmentCompatWithConstructSignatures5.ts(4,30): error TS2564: Property 'bar' has no initializer and is not definitely assigned in the constructor.
|
|
assignmentCompatWithConstructSignatures5.ts(5,34): error TS2564: Property 'baz' has no initializer and is not definitely assigned in the constructor.
|
|
assignmentCompatWithConstructSignatures5.ts(6,35): error TS2564: Property 'bing' has no initializer and is not definitely assigned in the constructor.
|
|
assignmentCompatWithConstructSignatures5.ts(40,1): error TS2322: Type 'new <T>(x: T) => void' is not assignable to type 'new <T>(x: T) => T'.
|
|
Type 'void' is not assignable to type 'T'.
|
|
'T' could be instantiated with an arbitrary type which could be unrelated to 'void'.
|
|
assignmentCompatWithConstructSignatures5.ts(52,1): error TS2322: Type 'new <T>(x: { foo: T; }, y: { foo: T; bar: T; }) => Base' is not assignable to type 'new <T, U>(x: { foo: T; }, y: { foo: U; bar: U; }) => Base'.
|
|
Types of parameters 'y' and 'y' are incompatible.
|
|
Type '{ foo: U; bar: U; }' is not assignable to type '{ foo: T; bar: T; }'.
|
|
Types of property 'foo' are incompatible.
|
|
Type 'U' is not assignable to type 'T'.
|
|
'T' could be instantiated with an arbitrary type which could be unrelated to 'U'.
|
|
assignmentCompatWithConstructSignatures5.ts(55,1): error TS2322: Type 'new <T>(x: { a: T; b: T; }) => T[]' is not assignable to type 'new <U, V>(x: { a: U; b: V; }) => U[]'.
|
|
Types of parameters 'x' and 'x' are incompatible.
|
|
Type '{ a: U; b: V; }' is not assignable to type '{ a: U; b: U; }'.
|
|
Types of property 'b' are incompatible.
|
|
Type 'V' is not assignable to type 'U'.
|
|
'U' could be instantiated with an arbitrary type which could be unrelated to 'V'.
|
|
assignmentCompatWithConstructSignatures5.ts(58,1): error TS2322: Type 'new <T extends Base>(x: { a: T; b: T; }) => T[]' is not assignable to type 'new <U, V>(x: { a: U; b: V; }) => U[]'.
|
|
Types of parameters 'x' and 'x' are incompatible.
|
|
Type '{ a: U; b: V; }' is not assignable to type '{ a: Base; b: Base; }'.
|
|
Types of property 'a' are incompatible.
|
|
Type 'U' is not assignable to type 'Base'.
|
|
|
|
|
|
==== assignmentCompatWithConstructSignatures5.ts (8 errors) ====
|
|
// checking assignment compat for function types. All valid
|
|
|
|
class Base { foo: string; }
|
|
~~~
|
|
!!! error TS2564: Property 'foo' has no initializer and is not definitely assigned in the constructor.
|
|
class Derived extends Base { bar: string; }
|
|
~~~
|
|
!!! error TS2564: Property 'bar' has no initializer and is not definitely assigned in the constructor.
|
|
class Derived2 extends Derived { baz: string; }
|
|
~~~
|
|
!!! error TS2564: Property 'baz' has no initializer and is not definitely assigned in the constructor.
|
|
class OtherDerived extends Base { bing: string; }
|
|
~~~~
|
|
!!! error TS2564: Property 'bing' has no initializer and is not definitely assigned in the constructor.
|
|
|
|
declare var a: new <T>(x: T) => T[];
|
|
declare var a2: new <T>(x: T) => string[];
|
|
declare var a3: new <T>(x: T) => void;
|
|
declare var a4: new <T, U>(x: T, y: U) => string;
|
|
declare var a5: new <T, U>(x: new (arg: T) => U) => T;
|
|
declare var a6: new <T extends Base>(x: new (arg: T) => Derived) => T;
|
|
declare var a11: new <T>(x: { foo: T }, y: { foo: T; bar: T }) => Base;
|
|
declare var a15: new <T>(x: { a: T; b: T }) => T[];
|
|
declare var a16: new <T extends Base>(x: { a: T; b: T }) => T[];
|
|
declare var a17: {
|
|
new <T extends Derived>(x: new (a: T) => T): T[];
|
|
new <T extends Base>(x: new (a: T) => T): T[];
|
|
};
|
|
declare var a18: {
|
|
new (x: {
|
|
new <T extends Derived>(a: T): T;
|
|
new <T extends Base>(a: T): T;
|
|
}): any[];
|
|
new (x: {
|
|
new <T extends Derived2>(a: T): T;
|
|
new <T extends Base>(a: T): T;
|
|
}): any[];
|
|
};
|
|
|
|
declare var b: new <T>(x: T) => T[];
|
|
a = b; // ok
|
|
b = a; // ok
|
|
declare var b2: new <T>(x: T) => string[];
|
|
a2 = b2; // ok
|
|
b2 = a2; // ok
|
|
declare var b3: new <T>(x: T) => T;
|
|
a3 = b3; // ok
|
|
b3 = a3; // ok
|
|
~~
|
|
!!! error TS2322: Type 'new <T>(x: T) => void' is not assignable to type 'new <T>(x: T) => T'.
|
|
!!! error TS2322: Type 'void' is not assignable to type 'T'.
|
|
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'void'.
|
|
declare var b4: new <T, U>(x: T, y: U) => string;
|
|
a4 = b4; // ok
|
|
b4 = a4; // ok
|
|
declare var b5: new <T, U>(x: new (arg: T) => U) => T;
|
|
a5 = b5; // ok
|
|
b5 = a5; // ok
|
|
declare var b6: new <T extends Base, U extends Derived>(x: new (arg: T) => U) => T;
|
|
a6 = b6; // ok
|
|
b6 = a6; // ok
|
|
declare var b11: new <T, U>(x: { foo: T }, y: { foo: U; bar: U }) => Base;
|
|
a11 = b11; // ok
|
|
b11 = a11; // ok
|
|
~~~
|
|
!!! error TS2322: Type 'new <T>(x: { foo: T; }, y: { foo: T; bar: T; }) => Base' is not assignable to type 'new <T, U>(x: { foo: T; }, y: { foo: U; bar: U; }) => Base'.
|
|
!!! error TS2322: Types of parameters 'y' and 'y' are incompatible.
|
|
!!! error TS2322: Type '{ foo: U; bar: U; }' is not assignable to type '{ foo: T; bar: T; }'.
|
|
!!! error TS2322: Types of property 'foo' are incompatible.
|
|
!!! error TS2322: Type 'U' is not assignable to type 'T'.
|
|
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'U'.
|
|
!!! related TS2208 assignmentCompatWithConstructSignatures5.ts:50:26: This type parameter might need an `extends T` constraint.
|
|
declare var b15: new <U, V>(x: { a: U; b: V; }) => U[];
|
|
a15 = b15; // ok
|
|
b15 = a15; // ok
|
|
~~~
|
|
!!! error TS2322: Type 'new <T>(x: { a: T; b: T; }) => T[]' is not assignable to type 'new <U, V>(x: { a: U; b: V; }) => U[]'.
|
|
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
|
|
!!! error TS2322: Type '{ a: U; b: V; }' is not assignable to type '{ a: U; b: U; }'.
|
|
!!! error TS2322: Types of property 'b' are incompatible.
|
|
!!! error TS2322: Type 'V' is not assignable to type 'U'.
|
|
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'V'.
|
|
!!! related TS2208 assignmentCompatWithConstructSignatures5.ts:53:26: This type parameter might need an `extends U` constraint.
|
|
declare var b16: new <T>(x: { a: T; b: T }) => T[];
|
|
a15 = b16; // ok
|
|
b15 = a16; // ok
|
|
~~~
|
|
!!! error TS2322: Type 'new <T extends Base>(x: { a: T; b: T; }) => T[]' is not assignable to type 'new <U, V>(x: { a: U; b: V; }) => U[]'.
|
|
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
|
|
!!! error TS2322: Type '{ a: U; b: V; }' is not assignable to type '{ a: Base; b: Base; }'.
|
|
!!! error TS2322: Types of property 'a' are incompatible.
|
|
!!! error TS2322: Type 'U' is not assignable to type 'Base'.
|
|
!!! related TS2208 assignmentCompatWithConstructSignatures5.ts:53:23: This type parameter might need an `extends Base` constraint.
|
|
declare var b17: new <T>(x: new (a: T) => T) => T[];
|
|
a17 = b17; // ok
|
|
b17 = a17; // ok
|
|
declare var b18: new (x: new <T>(a: T) => T) => any[];
|
|
a18 = b18; // ok
|
|
b18 = a18; // ok
|
|
|