273 lines
5.6 KiB
Text
273 lines
5.6 KiB
Text
=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures6.ts ===
|
|
// checking assignment compatibility relations for function types. All valid.
|
|
|
|
class Base { foo: string; }
|
|
>Base : Base
|
|
>foo : string
|
|
|
|
class Derived extends Base { bar: string; }
|
|
>Derived : Derived
|
|
>Base : Base
|
|
>bar : string
|
|
|
|
class Derived2 extends Derived { baz: string; }
|
|
>Derived2 : Derived2
|
|
>Derived : Derived
|
|
>baz : string
|
|
|
|
class OtherDerived extends Base { bing: string; }
|
|
>OtherDerived : OtherDerived
|
|
>Base : Base
|
|
>bing : string
|
|
|
|
interface A {
|
|
>A : A
|
|
|
|
a: new <T>(x: T) => T[];
|
|
>a : new <T>(x: T) => T[]
|
|
>T : T
|
|
>x : T
|
|
>T : T
|
|
>T : T
|
|
|
|
a2: new <T>(x: T) => string[];
|
|
>a2 : new <T>(x: T) => string[]
|
|
>T : T
|
|
>x : T
|
|
>T : T
|
|
|
|
a3: new <T>(x: T) => void;
|
|
>a3 : new <T>(x: T) => void
|
|
>T : T
|
|
>x : T
|
|
>T : T
|
|
|
|
a4: new <T, U>(x: T, y: U) => string;
|
|
>a4 : new <T, U>(x: T, y: U) => string
|
|
>T : T
|
|
>U : U
|
|
>x : T
|
|
>T : T
|
|
>y : U
|
|
>U : U
|
|
|
|
a5: new <T, U>(x: (arg: T) => U) => T;
|
|
>a5 : new <T, U>(x: (arg: T) => U) => T
|
|
>T : T
|
|
>U : U
|
|
>x : (arg: T) => U
|
|
>arg : T
|
|
>T : T
|
|
>U : U
|
|
>T : T
|
|
|
|
a6: new <T extends Base>(x: (arg: T) => Derived) => T;
|
|
>a6 : new <T extends Base>(x: (arg: T) => Derived) => T
|
|
>T : T
|
|
>Base : Base
|
|
>x : (arg: T) => Derived
|
|
>arg : T
|
|
>T : T
|
|
>Derived : Derived
|
|
>T : T
|
|
|
|
a11: new <T>(x: { foo: T }, y: { foo: T; bar: T }) => Base;
|
|
>a11 : new <T>(x: { foo: T; }, y: { foo: T; bar: T; }) => Base
|
|
>T : T
|
|
>x : { foo: T; }
|
|
>foo : T
|
|
>T : T
|
|
>y : { foo: T; bar: T; }
|
|
>foo : T
|
|
>T : T
|
|
>bar : T
|
|
>T : T
|
|
>Base : Base
|
|
|
|
a15: new <T>(x: { a: T; b: T }) => T[];
|
|
>a15 : new <T>(x: { a: T; b: T; }) => T[]
|
|
>T : T
|
|
>x : { a: T; b: T; }
|
|
>a : T
|
|
>T : T
|
|
>b : T
|
|
>T : T
|
|
>T : T
|
|
|
|
a16: new <T extends Base>(x: { a: T; b: T }) => T[];
|
|
>a16 : new <T extends Base>(x: { a: T; b: T; }) => T[]
|
|
>T : T
|
|
>Base : Base
|
|
>x : { a: T; b: T; }
|
|
>a : T
|
|
>T : T
|
|
>b : T
|
|
>T : T
|
|
>T : T
|
|
}
|
|
|
|
var x: A;
|
|
>x : A
|
|
>A : A
|
|
|
|
var b: new <T>(x: T) => T[];
|
|
>b : new <T>(x: T) => T[]
|
|
>T : T
|
|
>x : T
|
|
>T : T
|
|
>T : T
|
|
|
|
x.a = b;
|
|
>x.a = b : new <T>(x: T) => T[]
|
|
>x.a : new <T>(x: T) => T[]
|
|
>x : A
|
|
>a : new <T>(x: T) => T[]
|
|
>b : new <T>(x: T) => T[]
|
|
|
|
b = x.a;
|
|
>b = x.a : new <T>(x: T) => T[]
|
|
>b : new <T>(x: T) => T[]
|
|
>x.a : new <T>(x: T) => T[]
|
|
>x : A
|
|
>a : new <T>(x: T) => T[]
|
|
|
|
var b2: new <T>(x: T) => string[];
|
|
>b2 : new <T>(x: T) => string[]
|
|
>T : T
|
|
>x : T
|
|
>T : T
|
|
|
|
x.a2 = b2;
|
|
>x.a2 = b2 : new <T>(x: T) => string[]
|
|
>x.a2 : new <T>(x: T) => string[]
|
|
>x : A
|
|
>a2 : new <T>(x: T) => string[]
|
|
>b2 : new <T>(x: T) => string[]
|
|
|
|
b2 = x.a2;
|
|
>b2 = x.a2 : new <T>(x: T) => string[]
|
|
>b2 : new <T>(x: T) => string[]
|
|
>x.a2 : new <T>(x: T) => string[]
|
|
>x : A
|
|
>a2 : new <T>(x: T) => string[]
|
|
|
|
var b3: new <T>(x: T) => T;
|
|
>b3 : new <T>(x: T) => T
|
|
>T : T
|
|
>x : T
|
|
>T : T
|
|
>T : T
|
|
|
|
x.a3 = b3;
|
|
>x.a3 = b3 : new <T>(x: T) => T
|
|
>x.a3 : new <T>(x: T) => void
|
|
>x : A
|
|
>a3 : new <T>(x: T) => void
|
|
>b3 : new <T>(x: T) => T
|
|
|
|
b3 = x.a3;
|
|
>b3 = x.a3 : new <T>(x: T) => void
|
|
>b3 : new <T>(x: T) => T
|
|
>x.a3 : new <T>(x: T) => void
|
|
>x : A
|
|
>a3 : new <T>(x: T) => void
|
|
|
|
var b4: new <T, U>(x: T, y: U) => string;
|
|
>b4 : new <T, U>(x: T, y: U) => string
|
|
>T : T
|
|
>U : U
|
|
>x : T
|
|
>T : T
|
|
>y : U
|
|
>U : U
|
|
|
|
x.a4 = b4;
|
|
>x.a4 = b4 : new <T, U>(x: T, y: U) => string
|
|
>x.a4 : new <T, U>(x: T, y: U) => string
|
|
>x : A
|
|
>a4 : new <T, U>(x: T, y: U) => string
|
|
>b4 : new <T, U>(x: T, y: U) => string
|
|
|
|
b4 = x.a4;
|
|
>b4 = x.a4 : new <T, U>(x: T, y: U) => string
|
|
>b4 : new <T, U>(x: T, y: U) => string
|
|
>x.a4 : new <T, U>(x: T, y: U) => string
|
|
>x : A
|
|
>a4 : new <T, U>(x: T, y: U) => string
|
|
|
|
var b5: new <T, U>(x: (arg: T) => U) => T;
|
|
>b5 : new <T, U>(x: (arg: T) => U) => T
|
|
>T : T
|
|
>U : U
|
|
>x : (arg: T) => U
|
|
>arg : T
|
|
>T : T
|
|
>U : U
|
|
>T : T
|
|
|
|
x.a5 = b5;
|
|
>x.a5 = b5 : new <T, U>(x: (arg: T) => U) => T
|
|
>x.a5 : new <T, U>(x: (arg: T) => U) => T
|
|
>x : A
|
|
>a5 : new <T, U>(x: (arg: T) => U) => T
|
|
>b5 : new <T, U>(x: (arg: T) => U) => T
|
|
|
|
b5 = x.a5;
|
|
>b5 = x.a5 : new <T, U>(x: (arg: T) => U) => T
|
|
>b5 : new <T, U>(x: (arg: T) => U) => T
|
|
>x.a5 : new <T, U>(x: (arg: T) => U) => T
|
|
>x : A
|
|
>a5 : new <T, U>(x: (arg: T) => U) => T
|
|
|
|
var b11: new <T, U>(x: { foo: T }, y: { foo: U; bar: U }) => Base;
|
|
>b11 : new <T, U>(x: { foo: T; }, y: { foo: U; bar: U; }) => Base
|
|
>T : T
|
|
>U : U
|
|
>x : { foo: T; }
|
|
>foo : T
|
|
>T : T
|
|
>y : { foo: U; bar: U; }
|
|
>foo : U
|
|
>U : U
|
|
>bar : U
|
|
>U : U
|
|
>Base : Base
|
|
|
|
x.a11 = b11;
|
|
>x.a11 = b11 : new <T, U>(x: { foo: T; }, y: { foo: U; bar: U; }) => Base
|
|
>x.a11 : new <T>(x: { foo: T; }, y: { foo: T; bar: T; }) => Base
|
|
>x : A
|
|
>a11 : new <T>(x: { foo: T; }, y: { foo: T; bar: T; }) => Base
|
|
>b11 : new <T, U>(x: { foo: T; }, y: { foo: U; bar: U; }) => Base
|
|
|
|
b11 = x.a11;
|
|
>b11 = x.a11 : new <T>(x: { foo: T; }, y: { foo: T; bar: T; }) => Base
|
|
>b11 : new <T, U>(x: { foo: T; }, y: { foo: U; bar: U; }) => Base
|
|
>x.a11 : new <T>(x: { foo: T; }, y: { foo: T; bar: T; }) => Base
|
|
>x : A
|
|
>a11 : new <T>(x: { foo: T; }, y: { foo: T; bar: T; }) => Base
|
|
|
|
var b16: new <T>(x: { a: T; b: T }) => T[];
|
|
>b16 : new <T>(x: { a: T; b: T; }) => T[]
|
|
>T : T
|
|
>x : { a: T; b: T; }
|
|
>a : T
|
|
>T : T
|
|
>b : T
|
|
>T : T
|
|
>T : T
|
|
|
|
x.a16 = b16;
|
|
>x.a16 = b16 : new <T>(x: { a: T; b: T; }) => T[]
|
|
>x.a16 : new <T extends Base>(x: { a: T; b: T; }) => T[]
|
|
>x : A
|
|
>a16 : new <T extends Base>(x: { a: T; b: T; }) => T[]
|
|
>b16 : new <T>(x: { a: T; b: T; }) => T[]
|
|
|
|
b16 = x.a16;
|
|
>b16 = x.a16 : new <T extends Base>(x: { a: T; b: T; }) => T[]
|
|
>b16 : new <T>(x: { a: T; b: T; }) => T[]
|
|
>x.a16 : new <T extends Base>(x: { a: T; b: T; }) => T[]
|
|
>x : A
|
|
>a16 : new <T extends Base>(x: { a: T; b: T; }) => T[]
|
|
|