81 lines
2.5 KiB
Text
81 lines
2.5 KiB
Text
=== tests/cases/conformance/types/members/typesWithOptionalProperty.ts ===
|
|
// basic uses of optional properties without errors
|
|
|
|
interface I {
|
|
>I : Symbol(I, Decl(typesWithOptionalProperty.ts, 0, 0))
|
|
|
|
foo: string;
|
|
>foo : Symbol(foo, Decl(typesWithOptionalProperty.ts, 2, 13))
|
|
|
|
bar?: number;
|
|
>bar : Symbol(bar, Decl(typesWithOptionalProperty.ts, 3, 16))
|
|
|
|
baz? (): string;
|
|
>baz : Symbol(baz, Decl(typesWithOptionalProperty.ts, 4, 17))
|
|
}
|
|
|
|
var a: {
|
|
>a : Symbol(a, Decl(typesWithOptionalProperty.ts, 8, 3))
|
|
|
|
foo: string;
|
|
>foo : Symbol(foo, Decl(typesWithOptionalProperty.ts, 8, 8))
|
|
|
|
bar?: number;
|
|
>bar : Symbol(bar, Decl(typesWithOptionalProperty.ts, 9, 16))
|
|
|
|
baz? (): string;
|
|
>baz : Symbol(baz, Decl(typesWithOptionalProperty.ts, 10, 17))
|
|
|
|
};
|
|
|
|
var b = { foo: '' };
|
|
>b : Symbol(b, Decl(typesWithOptionalProperty.ts, 14, 3))
|
|
>foo : Symbol(foo, Decl(typesWithOptionalProperty.ts, 14, 9))
|
|
|
|
var c = { foo: '', bar: 3 };
|
|
>c : Symbol(c, Decl(typesWithOptionalProperty.ts, 15, 3))
|
|
>foo : Symbol(foo, Decl(typesWithOptionalProperty.ts, 15, 9))
|
|
>bar : Symbol(bar, Decl(typesWithOptionalProperty.ts, 15, 18))
|
|
|
|
var d = { foo: '', bar: 3, baz: () => '' };
|
|
>d : Symbol(d, Decl(typesWithOptionalProperty.ts, 16, 3))
|
|
>foo : Symbol(foo, Decl(typesWithOptionalProperty.ts, 16, 9))
|
|
>bar : Symbol(bar, Decl(typesWithOptionalProperty.ts, 16, 18))
|
|
>baz : Symbol(baz, Decl(typesWithOptionalProperty.ts, 16, 26))
|
|
|
|
var i: I;
|
|
>i : Symbol(i, Decl(typesWithOptionalProperty.ts, 18, 3))
|
|
>I : Symbol(I, Decl(typesWithOptionalProperty.ts, 0, 0))
|
|
|
|
i = b;
|
|
>i : Symbol(i, Decl(typesWithOptionalProperty.ts, 18, 3))
|
|
>b : Symbol(b, Decl(typesWithOptionalProperty.ts, 14, 3))
|
|
|
|
i = c;
|
|
>i : Symbol(i, Decl(typesWithOptionalProperty.ts, 18, 3))
|
|
>c : Symbol(c, Decl(typesWithOptionalProperty.ts, 15, 3))
|
|
|
|
i = d;
|
|
>i : Symbol(i, Decl(typesWithOptionalProperty.ts, 18, 3))
|
|
>d : Symbol(d, Decl(typesWithOptionalProperty.ts, 16, 3))
|
|
|
|
a = b;
|
|
>a : Symbol(a, Decl(typesWithOptionalProperty.ts, 8, 3))
|
|
>b : Symbol(b, Decl(typesWithOptionalProperty.ts, 14, 3))
|
|
|
|
a = c;
|
|
>a : Symbol(a, Decl(typesWithOptionalProperty.ts, 8, 3))
|
|
>c : Symbol(c, Decl(typesWithOptionalProperty.ts, 15, 3))
|
|
|
|
a = d;
|
|
>a : Symbol(a, Decl(typesWithOptionalProperty.ts, 8, 3))
|
|
>d : Symbol(d, Decl(typesWithOptionalProperty.ts, 16, 3))
|
|
|
|
i = a;
|
|
>i : Symbol(i, Decl(typesWithOptionalProperty.ts, 18, 3))
|
|
>a : Symbol(a, Decl(typesWithOptionalProperty.ts, 8, 3))
|
|
|
|
a = i;
|
|
>a : Symbol(a, Decl(typesWithOptionalProperty.ts, 8, 3))
|
|
>i : Symbol(i, Decl(typesWithOptionalProperty.ts, 18, 3))
|
|
|