1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(7,1): error TS2322: Type 'I' is not assignable to type 'Object'.
The types returned by 'toString()' are incompatible between these types.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(8,1): error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
The types returned by 'toString()' are incompatible between these types.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(14,1): error TS2322: Type 'C' is not assignable to type 'Object'.
The types returned by 'toString()' are incompatible between these types.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(15,1): error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
The types returned by 'toString()' are incompatible between these types.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(20,1): error TS2322: Type '{ toString: () => void; }' is not assignable to type 'Object'.
The types returned by 'toString()' are incompatible between these types.
Type 'void' is not assignable to type 'string'.
==== tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts (5 errors) ====
interface I {
toString(): number;
}
var i: I;
var o: Object;
o = i; // error
~
!!! error TS2322: Type 'I' is not assignable to type 'Object'.
!!! error TS2322: The types returned by 'toString()' are incompatible between these types.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
i = o; // error
~
!!! error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
!!! error TS2696: The types returned by 'toString()' are incompatible between these types.
!!! error TS2696: Type 'string' is not assignable to type 'number'.
class C {
toString(): number { return 1; }
}
var c: C;
o = c; // error
~
!!! error TS2322: Type 'C' is not assignable to type 'Object'.
!!! error TS2322: The types returned by 'toString()' are incompatible between these types.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
c = o; // error
~
!!! error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
!!! error TS2696: The types returned by 'toString()' are incompatible between these types.
!!! error TS2696: Type 'string' is not assignable to type 'number'.
var a = {
toString: () => { }
}
o = a; // error
~
!!! error TS2322: Type '{ toString: () => void; }' is not assignable to type 'Object'.
!!! error TS2322: The types returned by 'toString()' are incompatible between these types.
!!! error TS2322: Type 'void' is not assignable to type 'string'.
a = o; // ok
|