TypeScript/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.errors.txt
2014-09-12 13:35:07 -07:00

81 lines
3.9 KiB
Plaintext

tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'constructor' of type 'Function' is not assignable to string index type 'Object'.
tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'data' of type 'A' is not assignable to string index type 'Object'.
tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'hasOwnProperty' of type '(v: string) => boolean' is not assignable to string index type 'Object'.
tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'isPrototypeOf' of type '(v: Object) => boolean' is not assignable to string index type 'Object'.
tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'propertyIsEnumerable' of type '(v: string) => boolean' is not assignable to string index type 'Object'.
tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'toLocaleString' of type '() => string' is not assignable to string index type 'Object'.
tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'toString' of type '() => string' is not assignable to string index type 'Object'.
tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(11,5): error TS2411: Property 'valueOf' of type '() => Object' is not assignable to string index type 'Object'.
==== tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts (8 errors) ====
class A {
foo: string;
}
class B extends A {
bar: string;
}
interface Object {
data: A;
[x: string]: Object;
~~~~~~~~~~~~~~~~~~~~
!!! error TS2411: Property 'constructor' of type 'Function' is not assignable to string index type 'Object'.
~~~~~~~~~~~~~~~~~~~~
!!! error TS2411: Property 'data' of type 'A' is not assignable to string index type 'Object'.
~~~~~~~~~~~~~~~~~~~~
!!! error TS2411: Property 'hasOwnProperty' of type '(v: string) => boolean' is not assignable to string index type 'Object'.
~~~~~~~~~~~~~~~~~~~~
!!! error TS2411: Property 'isPrototypeOf' of type '(v: Object) => boolean' is not assignable to string index type 'Object'.
~~~~~~~~~~~~~~~~~~~~
!!! error TS2411: Property 'propertyIsEnumerable' of type '(v: string) => boolean' is not assignable to string index type 'Object'.
~~~~~~~~~~~~~~~~~~~~
!!! error TS2411: Property 'toLocaleString' of type '() => string' is not assignable to string index type 'Object'.
~~~~~~~~~~~~~~~~~~~~
!!! error TS2411: Property 'toString' of type '() => string' is not assignable to string index type 'Object'.
~~~~~~~~~~~~~~~~~~~~
!!! error TS2411: Property 'valueOf' of type '() => Object' is not assignable to string index type 'Object'.
}
class C {
valueOf() { }
data: B;
[x: string]: any;
}
var c: C;
var r1: void = c.valueOf();
var r1b: B = c.data;
var r1c = r1b['hm']; // should be 'Object'
var r1d = c['hm']; // should be 'any'
interface I {
valueOf(): void;
data: B;
[x: string]: any;
}
var i: I;
var r2: void = i.valueOf();
var r2b: B = i.data;
var r2c = r2b['hm']; // should be 'Object'
var r2d = i['hm']; // should be 'any'
var a = {
valueOf: () => { },
data: new B()
}
var r3: void = a.valueOf();
var r3b: B = a.data;
var r3c = r3b['hm']; // should be 'Object'
var r3d = i['hm'];
var b: {
valueOf(): void;
data: B;
[x: string]: any;
}
var r4: void = b.valueOf();