TypeScript/tests/baselines/reference/typesWithOptionalProperty.types

100 lines
3.8 KiB
Text
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/conformance/types/members/typesWithOptionalProperty.ts ===
// basic uses of optional properties without errors
interface I {
2015-04-13 23:01:57 +02:00
>I : I, Symbol(I, Decl(typesWithOptionalProperty.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(typesWithOptionalProperty.ts, 2, 13))
2014-08-15 23:33:16 +02:00
bar?: number;
2015-04-13 23:01:57 +02:00
>bar : number, Symbol(bar, Decl(typesWithOptionalProperty.ts, 3, 16))
2014-08-15 23:33:16 +02:00
baz? (): string;
2015-04-13 23:01:57 +02:00
>baz : () => string, Symbol(baz, Decl(typesWithOptionalProperty.ts, 4, 17))
2014-08-15 23:33:16 +02:00
}
var a: {
2015-04-13 23:01:57 +02:00
>a : { foo: string; bar?: number; baz?(): string; }, Symbol(a, Decl(typesWithOptionalProperty.ts, 8, 3))
2014-08-15 23:33:16 +02:00
foo: string;
2015-04-13 23:01:57 +02:00
>foo : string, Symbol(foo, Decl(typesWithOptionalProperty.ts, 8, 8))
2014-08-15 23:33:16 +02:00
bar?: number;
2015-04-13 23:01:57 +02:00
>bar : number, Symbol(bar, Decl(typesWithOptionalProperty.ts, 9, 16))
2014-08-15 23:33:16 +02:00
baz? (): string;
2015-04-13 23:01:57 +02:00
>baz : () => string, Symbol(baz, Decl(typesWithOptionalProperty.ts, 10, 17))
2014-08-15 23:33:16 +02:00
};
var b = { foo: '' };
2015-04-13 23:01:57 +02:00
>b : { foo: string; }, Symbol(b, Decl(typesWithOptionalProperty.ts, 14, 3))
2014-08-15 23:33:16 +02:00
>{ foo: '' } : { foo: string; }
2015-04-13 23:01:57 +02:00
>foo : string, Symbol(foo, Decl(typesWithOptionalProperty.ts, 14, 9))
2015-04-13 21:36:11 +02:00
>'' : string
2014-08-15 23:33:16 +02:00
var c = { foo: '', bar: 3 };
2015-04-13 23:01:57 +02:00
>c : { foo: string; bar: number; }, Symbol(c, Decl(typesWithOptionalProperty.ts, 15, 3))
2014-08-15 23:33:16 +02:00
>{ foo: '', bar: 3 } : { foo: string; bar: number; }
2015-04-13 23:01:57 +02:00
>foo : string, Symbol(foo, Decl(typesWithOptionalProperty.ts, 15, 9))
2015-04-13 21:36:11 +02:00
>'' : string
2015-04-13 23:01:57 +02:00
>bar : number, Symbol(bar, Decl(typesWithOptionalProperty.ts, 15, 18))
2015-04-13 21:36:11 +02:00
>3 : number
2014-08-15 23:33:16 +02:00
var d = { foo: '', bar: 3, baz: () => '' };
2015-04-13 23:01:57 +02:00
>d : { foo: string; bar: number; baz: () => string; }, Symbol(d, Decl(typesWithOptionalProperty.ts, 16, 3))
2014-08-15 23:33:16 +02:00
>{ foo: '', bar: 3, baz: () => '' } : { foo: string; bar: number; baz: () => string; }
2015-04-13 23:01:57 +02:00
>foo : string, Symbol(foo, Decl(typesWithOptionalProperty.ts, 16, 9))
2015-04-13 21:36:11 +02:00
>'' : string
2015-04-13 23:01:57 +02:00
>bar : number, Symbol(bar, Decl(typesWithOptionalProperty.ts, 16, 18))
2015-04-13 21:36:11 +02:00
>3 : number
2015-04-13 23:01:57 +02:00
>baz : () => string, Symbol(baz, Decl(typesWithOptionalProperty.ts, 16, 26))
2014-08-15 23:33:16 +02:00
>() => '' : () => string
2015-04-13 21:36:11 +02:00
>'' : string
2014-08-15 23:33:16 +02:00
var i: I;
2015-04-13 23:01:57 +02:00
>i : I, Symbol(i, Decl(typesWithOptionalProperty.ts, 18, 3))
>I : I, Symbol(I, Decl(typesWithOptionalProperty.ts, 0, 0))
2014-08-15 23:33:16 +02:00
i = b;
>i = b : { foo: string; }
2015-04-13 23:01:57 +02:00
>i : I, Symbol(i, Decl(typesWithOptionalProperty.ts, 18, 3))
>b : { foo: string; }, Symbol(b, Decl(typesWithOptionalProperty.ts, 14, 3))
2014-08-15 23:33:16 +02:00
i = c;
>i = c : { foo: string; bar: number; }
2015-04-13 23:01:57 +02:00
>i : I, Symbol(i, Decl(typesWithOptionalProperty.ts, 18, 3))
>c : { foo: string; bar: number; }, Symbol(c, Decl(typesWithOptionalProperty.ts, 15, 3))
2014-08-15 23:33:16 +02:00
i = d;
>i = d : { foo: string; bar: number; baz: () => string; }
2015-04-13 23:01:57 +02:00
>i : I, Symbol(i, Decl(typesWithOptionalProperty.ts, 18, 3))
>d : { foo: string; bar: number; baz: () => string; }, Symbol(d, Decl(typesWithOptionalProperty.ts, 16, 3))
2014-08-15 23:33:16 +02:00
a = b;
>a = b : { foo: string; }
2015-04-13 23:01:57 +02:00
>a : { foo: string; bar?: number; baz?(): string; }, Symbol(a, Decl(typesWithOptionalProperty.ts, 8, 3))
>b : { foo: string; }, Symbol(b, Decl(typesWithOptionalProperty.ts, 14, 3))
2014-08-15 23:33:16 +02:00
a = c;
>a = c : { foo: string; bar: number; }
2015-04-13 23:01:57 +02:00
>a : { foo: string; bar?: number; baz?(): string; }, Symbol(a, Decl(typesWithOptionalProperty.ts, 8, 3))
>c : { foo: string; bar: number; }, Symbol(c, Decl(typesWithOptionalProperty.ts, 15, 3))
2014-08-15 23:33:16 +02:00
a = d;
>a = d : { foo: string; bar: number; baz: () => string; }
2015-04-13 23:01:57 +02:00
>a : { foo: string; bar?: number; baz?(): string; }, Symbol(a, Decl(typesWithOptionalProperty.ts, 8, 3))
>d : { foo: string; bar: number; baz: () => string; }, Symbol(d, Decl(typesWithOptionalProperty.ts, 16, 3))
2014-08-15 23:33:16 +02:00
i = a;
>i = a : { foo: string; bar?: number; baz?(): string; }
2015-04-13 23:01:57 +02:00
>i : I, Symbol(i, Decl(typesWithOptionalProperty.ts, 18, 3))
>a : { foo: string; bar?: number; baz?(): string; }, Symbol(a, Decl(typesWithOptionalProperty.ts, 8, 3))
2014-08-15 23:33:16 +02:00
a = i;
>a = i : I
2015-04-13 23:01:57 +02:00
>a : { foo: string; bar?: number; baz?(): string; }, Symbol(a, Decl(typesWithOptionalProperty.ts, 8, 3))
>i : I, Symbol(i, Decl(typesWithOptionalProperty.ts, 18, 3))
2014-08-15 23:33:16 +02:00