TypeScript/tests/baselines/reference/assignmentCompatWithObjectMembers4.errors.txt

219 lines
11 KiB
Plaintext
Raw Normal View History

2014-11-05 21:26:03 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(24,5): error TS2322: Type 'T' is not assignable to type 'S'.
Types of property 'foo' are incompatible.
Type 'Derived2' is not assignable to type 'Derived'.
Property 'bar' is missing in type 'Derived2'.
2014-11-05 21:26:03 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(25,5): error TS2322: Type 'S' is not assignable to type 'T'.
Types of property 'foo' are incompatible.
Type 'Derived' is not assignable to type 'Derived2'.
Property 'baz' is missing in type 'Derived'.
2014-11-05 21:26:03 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(29,5): error TS2322: Type 'T2' is not assignable to type 'S2'.
Types of property 'foo' are incompatible.
Type 'Derived2' is not assignable to type 'Derived'.
2014-11-05 21:26:03 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(30,5): error TS2322: Type 'S2' is not assignable to type 'T2'.
Types of property 'foo' are incompatible.
Type 'Derived' is not assignable to type 'Derived2'.
2014-11-05 21:26:03 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(31,5): error TS2322: Type 'T' is not assignable to type 'S2'.
Types of property 'foo' are incompatible.
Type 'Derived2' is not assignable to type 'Derived'.
2014-11-05 21:26:03 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(32,5): error TS2322: Type '{ foo: Derived2; }' is not assignable to type 'S2'.
Types of property 'foo' are incompatible.
Type 'Derived2' is not assignable to type 'Derived'.
2014-11-05 21:26:03 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(35,5): error TS2322: Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }'.
Types of property 'foo' are incompatible.
Type 'Derived2' is not assignable to type 'Derived'.
2014-11-05 21:26:03 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(36,5): error TS2322: Type '{ foo: Derived; }' is not assignable to type '{ foo: Derived2; }'.
Types of property 'foo' are incompatible.
Type 'Derived' is not assignable to type 'Derived2'.
2014-11-05 21:26:03 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(41,5): error TS2322: Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }'.
Types of property 'foo' are incompatible.
Type 'Derived2' is not assignable to type 'Derived'.
2014-11-05 21:26:03 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(42,5): error TS2322: Type '{ foo: Derived; }' is not assignable to type '{ foo: Derived2; }'.
Types of property 'foo' are incompatible.
Type 'Derived' is not assignable to type 'Derived2'.
2014-11-05 21:26:03 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(43,5): error TS2322: Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }'.
Types of property 'foo' are incompatible.
Type 'Derived2' is not assignable to type 'Derived'.
2014-11-05 21:26:03 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(44,5): error TS2322: Type 'T2' is not assignable to type '{ foo: Derived; }'.
Types of property 'foo' are incompatible.
Type 'Derived2' is not assignable to type 'Derived'.
2014-11-05 21:26:03 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(45,5): error TS2322: Type 'T' is not assignable to type '{ foo: Derived; }'.
Types of property 'foo' are incompatible.
Type 'Derived2' is not assignable to type 'Derived'.
2014-11-05 21:26:03 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(70,5): error TS2322: Type 'S' is not assignable to type 'T'.
Types of property 'foo' are incompatible.
Type 'Base' is not assignable to type 'Derived2'.
Property 'baz' is missing in type 'Base'.
2014-11-05 21:26:03 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(75,5): error TS2322: Type 'S2' is not assignable to type 'T2'.
Types of property 'foo' are incompatible.
Type 'Base' is not assignable to type 'Derived2'.
2014-11-05 21:26:03 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(81,5): error TS2322: Type '{ foo: Base; }' is not assignable to type '{ foo: Derived2; }'.
Types of property 'foo' are incompatible.
Type 'Base' is not assignable to type 'Derived2'.
2014-11-05 21:26:03 +01:00
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts(87,5): error TS2322: Type '{ foo: Base; }' is not assignable to type '{ foo: Derived2; }'.
Types of property 'foo' are incompatible.
Type 'Base' is not assignable to type 'Derived2'.
2014-07-13 01:04:16 +02:00
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers4.ts (17 errors) ====
// members N and M of types S and T have the same name, same accessibility, same optionality, and N is not assignable M
module OnlyDerived {
class Base { foo: string; }
class Derived extends Base { bar: string; }
class Derived2 extends Base { baz: string; }
class S { foo: Derived; }
class T { foo: Derived2; }
var s: S;
var t: T;
interface S2 { foo: Derived; }
interface T2 { foo: Derived2; }
var s2: S2;
var t2: T2;
var a: { foo: Derived; }
var b: { foo: Derived2; }
var a2 = { foo: new Derived() };
var b2 = { foo: new Derived2() };
s = t; // error
~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'T' is not assignable to type 'S'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived'.
!!! error TS2322: Property 'bar' is missing in type 'Derived2'.
2014-07-13 01:04:16 +02:00
t = s; // error
~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'S' is not assignable to type 'T'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type 'Derived' is not assignable to type 'Derived2'.
!!! error TS2322: Property 'baz' is missing in type 'Derived'.
2014-07-13 01:04:16 +02:00
s = s2; // ok
s = a2; // ok
s2 = t2; // error
~~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'T2' is not assignable to type 'S2'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived'.
2014-07-13 01:04:16 +02:00
t2 = s2; // error
~~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'S2' is not assignable to type 'T2'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type 'Derived' is not assignable to type 'Derived2'.
2014-07-13 01:04:16 +02:00
s2 = t; // error
~~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'T' is not assignable to type 'S2'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived'.
2014-07-13 01:04:16 +02:00
s2 = b; // error
~~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type '{ foo: Derived2; }' is not assignable to type 'S2'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived'.
2014-07-13 01:04:16 +02:00
s2 = a2; // ok
a = b; // error
~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived'.
2014-07-13 01:04:16 +02:00
b = a; // error
~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type '{ foo: Derived; }' is not assignable to type '{ foo: Derived2; }'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type 'Derived' is not assignable to type 'Derived2'.
2014-07-13 01:04:16 +02:00
a = s; // ok
a = s2; // ok
a = a2; // ok
a2 = b2; // error
~~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived'.
2014-07-13 01:04:16 +02:00
b2 = a2; // error
~~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type '{ foo: Derived; }' is not assignable to type '{ foo: Derived2; }'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type 'Derived' is not assignable to type 'Derived2'.
2014-07-13 01:04:16 +02:00
a2 = b; // error
~~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type '{ foo: Derived2; }' is not assignable to type '{ foo: Derived; }'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived'.
2014-07-13 01:04:16 +02:00
a2 = t2; // error
~~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'T2' is not assignable to type '{ foo: Derived; }'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived'.
2014-07-13 01:04:16 +02:00
a2 = t; // error
~~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'T' is not assignable to type '{ foo: Derived; }'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived'.
2014-07-13 01:04:16 +02:00
}
module WithBase {
class Base { foo: string; }
class Derived extends Base { bar: string; }
class Derived2 extends Base { baz: string; }
class S { foo: Base; }
class T { foo: Derived2; }
var s: S;
var t: T;
interface S2 { foo: Base; }
interface T2 { foo: Derived2; }
var s2: S2;
var t2: T2;
var a: { foo: Base; }
var b: { foo: Derived2; }
var a2 = { foo: new Base() };
var b2 = { foo: new Derived2() };
s = t; // ok
t = s; // error
~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'S' is not assignable to type 'T'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'.
!!! error TS2322: Property 'baz' is missing in type 'Base'.
2014-07-13 01:04:16 +02:00
s = s2; // ok
s = a2; // ok
s2 = t2; // ok
t2 = s2; // error
~~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'S2' is not assignable to type 'T2'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'.
2014-07-13 01:04:16 +02:00
s2 = t; // ok
s2 = b; // ok
s2 = a2; // ok
a = b; // ok
b = a; // error
~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type '{ foo: Base; }' is not assignable to type '{ foo: Derived2; }'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'.
2014-07-13 01:04:16 +02:00
a = s; // ok
a = s2; // ok
a = a2; // ok
a2 = b2; // ok
b2 = a2; // error
~~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type '{ foo: Base; }' is not assignable to type '{ foo: Derived2; }'.
!!! error TS2322: Types of property 'foo' are incompatible.
!!! error TS2322: Type 'Base' is not assignable to type 'Derived2'.
2014-07-13 01:04:16 +02:00
a2 = b; // ok
a2 = t2; // ok
a2 = t; // ok
}