TypeScript/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat.errors.txt
2014-07-12 17:30:19 -07:00

37 lines
1.2 KiB
Plaintext

==== tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat.ts (3 errors) ====
interface I {
toString(): void;
}
var i: I;
var o: Object;
o = i; // error
~
!!! Type 'I' is not assignable to type 'Object':
!!! Types of property 'toString' are incompatible:
!!! Type '() => void' is not assignable to type '() => string':
!!! Type 'void' is not assignable to type 'string'.
i = o; // ok
class C {
toString(): void { }
}
var c: C;
o = c; // error
~
!!! Type 'C' is not assignable to type 'Object':
!!! Types of property 'toString' are incompatible:
!!! Type '() => void' is not assignable to type '() => string':
!!! Type 'void' is not assignable to type 'string'.
c = o; // ok
var a = {
toString: () => { }
}
o = a; // error
~
!!! Type '{ toString: () => void; }' is not assignable to type 'Object':
!!! Types of property 'toString' are incompatible:
!!! Type '() => void' is not assignable to type '() => string':
!!! Type 'void' is not assignable to type 'string'.
a = o; // ok