TypeScript/tests/baselines/reference/objectTypePropertyAccess.types

111 lines
4.5 KiB
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/conformance/types/members/objectTypePropertyAccess.ts ===
// Index notation should resolve to the type of a declared property with that same name
class C {
2015-04-13 23:01:57 +02:00
>C : C, Symbol(C, Decl(objectTypePropertyAccess.ts, 0, 0))
2014-08-15 23:33:16 +02:00
foo: string;
2015-04-13 23:01:57 +02:00
>foo : string, Symbol(foo, Decl(objectTypePropertyAccess.ts, 1, 9))
2014-08-15 23:33:16 +02:00
}
var c: C;
2015-04-13 23:01:57 +02:00
>c : C, Symbol(c, Decl(objectTypePropertyAccess.ts, 5, 3))
>C : C, Symbol(C, Decl(objectTypePropertyAccess.ts, 0, 0))
2014-08-15 23:33:16 +02:00
var r1 = c.toString();
2015-04-13 23:01:57 +02:00
>r1 : string, Symbol(r1, Decl(objectTypePropertyAccess.ts, 6, 3))
2014-08-15 23:33:16 +02:00
>c.toString() : string
2015-04-13 23:01:57 +02:00
>c.toString : () => string, Symbol(Object.toString, Decl(lib.d.ts, 96, 26))
>c : C, Symbol(c, Decl(objectTypePropertyAccess.ts, 5, 3))
>toString : () => string, Symbol(Object.toString, Decl(lib.d.ts, 96, 26))
2014-08-15 23:33:16 +02:00
var r2 = c['toString']();
2015-04-13 23:01:57 +02:00
>r2 : string, Symbol(r2, Decl(objectTypePropertyAccess.ts, 7, 3))
2014-08-15 23:33:16 +02:00
>c['toString']() : string
>c['toString'] : () => string
2015-04-13 23:01:57 +02:00
>c : C, Symbol(c, Decl(objectTypePropertyAccess.ts, 5, 3))
>'toString' : string, Symbol(Object.toString, Decl(lib.d.ts, 96, 26))
2014-08-15 23:33:16 +02:00
var r3 = c.foo;
2015-04-13 23:01:57 +02:00
>r3 : string, Symbol(r3, Decl(objectTypePropertyAccess.ts, 8, 3))
>c.foo : string, Symbol(C.foo, Decl(objectTypePropertyAccess.ts, 1, 9))
>c : C, Symbol(c, Decl(objectTypePropertyAccess.ts, 5, 3))
>foo : string, Symbol(C.foo, Decl(objectTypePropertyAccess.ts, 1, 9))
2014-08-15 23:33:16 +02:00
var r4 = c['foo'];
2015-04-13 23:01:57 +02:00
>r4 : string, Symbol(r4, Decl(objectTypePropertyAccess.ts, 9, 3), Decl(objectTypePropertyAccess.ts, 15, 3))
2014-08-15 23:33:16 +02:00
>c['foo'] : string
2015-04-13 23:01:57 +02:00
>c : C, Symbol(c, Decl(objectTypePropertyAccess.ts, 5, 3))
>'foo' : string, Symbol(C.foo, Decl(objectTypePropertyAccess.ts, 1, 9))
2014-08-15 23:33:16 +02:00
interface I {
2015-04-13 23:01:57 +02:00
>I : I, Symbol(I, Decl(objectTypePropertyAccess.ts, 9, 18))
2014-08-15 23:33:16 +02:00
bar: string;
2015-04-13 23:01:57 +02:00
>bar : string, Symbol(bar, Decl(objectTypePropertyAccess.ts, 11, 13))
2014-08-15 23:33:16 +02:00
}
var i: I;
2015-04-13 23:01:57 +02:00
>i : I, Symbol(i, Decl(objectTypePropertyAccess.ts, 14, 3))
>I : I, Symbol(I, Decl(objectTypePropertyAccess.ts, 9, 18))
2014-08-15 23:33:16 +02:00
var r4 = i.toString();
2015-04-13 23:01:57 +02:00
>r4 : string, Symbol(r4, Decl(objectTypePropertyAccess.ts, 9, 3), Decl(objectTypePropertyAccess.ts, 15, 3))
2014-08-15 23:33:16 +02:00
>i.toString() : string
2015-04-13 23:01:57 +02:00
>i.toString : () => string, Symbol(Object.toString, Decl(lib.d.ts, 96, 26))
>i : I, Symbol(i, Decl(objectTypePropertyAccess.ts, 14, 3))
>toString : () => string, Symbol(Object.toString, Decl(lib.d.ts, 96, 26))
2014-08-15 23:33:16 +02:00
var r5 = i['toString']();
2015-04-13 23:01:57 +02:00
>r5 : string, Symbol(r5, Decl(objectTypePropertyAccess.ts, 16, 3))
2014-08-15 23:33:16 +02:00
>i['toString']() : string
>i['toString'] : () => string
2015-04-13 23:01:57 +02:00
>i : I, Symbol(i, Decl(objectTypePropertyAccess.ts, 14, 3))
>'toString' : string, Symbol(Object.toString, Decl(lib.d.ts, 96, 26))
2014-08-15 23:33:16 +02:00
var r6 = i.bar;
2015-04-13 23:01:57 +02:00
>r6 : string, Symbol(r6, Decl(objectTypePropertyAccess.ts, 17, 3))
>i.bar : string, Symbol(I.bar, Decl(objectTypePropertyAccess.ts, 11, 13))
>i : I, Symbol(i, Decl(objectTypePropertyAccess.ts, 14, 3))
>bar : string, Symbol(I.bar, Decl(objectTypePropertyAccess.ts, 11, 13))
2014-08-15 23:33:16 +02:00
var r7 = i['bar'];
2015-04-13 23:01:57 +02:00
>r7 : string, Symbol(r7, Decl(objectTypePropertyAccess.ts, 18, 3))
2014-08-15 23:33:16 +02:00
>i['bar'] : string
2015-04-13 23:01:57 +02:00
>i : I, Symbol(i, Decl(objectTypePropertyAccess.ts, 14, 3))
>'bar' : string, Symbol(I.bar, Decl(objectTypePropertyAccess.ts, 11, 13))
2014-08-15 23:33:16 +02:00
var a = {
2015-04-13 23:01:57 +02:00
>a : { foo: string; }, Symbol(a, Decl(objectTypePropertyAccess.ts, 20, 3))
2014-08-22 03:39:46 +02:00
>{ foo: ''} : { foo: string; }
2014-08-15 23:33:16 +02:00
foo: ''
2015-04-13 23:01:57 +02:00
>foo : string, Symbol(foo, Decl(objectTypePropertyAccess.ts, 20, 9))
2015-04-13 21:36:11 +02:00
>'' : string
2014-08-15 23:33:16 +02:00
}
var r8 = a.toString();
2015-04-13 23:01:57 +02:00
>r8 : string, Symbol(r8, Decl(objectTypePropertyAccess.ts, 24, 3))
2014-08-15 23:33:16 +02:00
>a.toString() : string
2015-04-13 23:01:57 +02:00
>a.toString : () => string, Symbol(Object.toString, Decl(lib.d.ts, 96, 26))
>a : { foo: string; }, Symbol(a, Decl(objectTypePropertyAccess.ts, 20, 3))
>toString : () => string, Symbol(Object.toString, Decl(lib.d.ts, 96, 26))
2014-08-15 23:33:16 +02:00
var r9 = a['toString']();
2015-04-13 23:01:57 +02:00
>r9 : string, Symbol(r9, Decl(objectTypePropertyAccess.ts, 25, 3))
2014-08-15 23:33:16 +02:00
>a['toString']() : string
>a['toString'] : () => string
2015-04-13 23:01:57 +02:00
>a : { foo: string; }, Symbol(a, Decl(objectTypePropertyAccess.ts, 20, 3))
>'toString' : string, Symbol(Object.toString, Decl(lib.d.ts, 96, 26))
2014-08-15 23:33:16 +02:00
var r10 = a.foo;
2015-04-13 23:01:57 +02:00
>r10 : string, Symbol(r10, Decl(objectTypePropertyAccess.ts, 26, 3))
>a.foo : string, Symbol(foo, Decl(objectTypePropertyAccess.ts, 20, 9))
>a : { foo: string; }, Symbol(a, Decl(objectTypePropertyAccess.ts, 20, 3))
>foo : string, Symbol(foo, Decl(objectTypePropertyAccess.ts, 20, 9))
2014-08-15 23:33:16 +02:00
var r11 = a['foo'];
2015-04-13 23:01:57 +02:00
>r11 : string, Symbol(r11, Decl(objectTypePropertyAccess.ts, 27, 3))
2014-08-15 23:33:16 +02:00
>a['foo'] : string
2015-04-13 23:01:57 +02:00
>a : { foo: string; }, Symbol(a, Decl(objectTypePropertyAccess.ts, 20, 3))
>'foo' : string, Symbol(foo, Decl(objectTypePropertyAccess.ts, 20, 9))
2014-08-15 23:33:16 +02:00