1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
=== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersOptionality3.ts ===
// Base property is optional and derived type has no property of that name
interface Base { foo: string; }
>Base : Symbol(Base, Decl(subtypingWithObjectMembersOptionality3.ts, 0, 0))
>foo : Symbol(Base.foo, Decl(subtypingWithObjectMembersOptionality3.ts, 2, 16))
interface Derived extends Base { bar: string; }
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembersOptionality3.ts, 2, 31))
>Base : Symbol(Base, Decl(subtypingWithObjectMembersOptionality3.ts, 0, 0))
>bar : Symbol(Derived.bar, Decl(subtypingWithObjectMembersOptionality3.ts, 3, 32))
interface T {
>T : Symbol(T, Decl(subtypingWithObjectMembersOptionality3.ts, 3, 47))
Foo?: Base;
>Foo : Symbol(T.Foo, Decl(subtypingWithObjectMembersOptionality3.ts, 5, 13))
>Base : Symbol(Base, Decl(subtypingWithObjectMembersOptionality3.ts, 0, 0))
}
interface S extends T {
>S : Symbol(S, Decl(subtypingWithObjectMembersOptionality3.ts, 7, 1))
>T : Symbol(T, Decl(subtypingWithObjectMembersOptionality3.ts, 3, 47))
Foo2: Derived // ok
>Foo2 : Symbol(S.Foo2, Decl(subtypingWithObjectMembersOptionality3.ts, 9, 23))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembersOptionality3.ts, 2, 31))
}
interface T2 {
>T2 : Symbol(T2, Decl(subtypingWithObjectMembersOptionality3.ts, 11, 1))
1?: Base;
>1 : Symbol(T2[1], Decl(subtypingWithObjectMembersOptionality3.ts, 13, 14))
>Base : Symbol(Base, Decl(subtypingWithObjectMembersOptionality3.ts, 0, 0))
}
interface S2 extends T2 {
>S2 : Symbol(S2, Decl(subtypingWithObjectMembersOptionality3.ts, 15, 1))
>T2 : Symbol(T2, Decl(subtypingWithObjectMembersOptionality3.ts, 11, 1))
2: Derived; // ok
>2 : Symbol(S2[2], Decl(subtypingWithObjectMembersOptionality3.ts, 17, 25))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembersOptionality3.ts, 2, 31))
}
interface T3 {
>T3 : Symbol(T3, Decl(subtypingWithObjectMembersOptionality3.ts, 19, 1))
'1'?: Base;
>'1' : Symbol(T3['1'], Decl(subtypingWithObjectMembersOptionality3.ts, 21, 14))
>Base : Symbol(Base, Decl(subtypingWithObjectMembersOptionality3.ts, 0, 0))
}
interface S3 extends T3 {
>S3 : Symbol(S3, Decl(subtypingWithObjectMembersOptionality3.ts, 23, 1))
>T3 : Symbol(T3, Decl(subtypingWithObjectMembersOptionality3.ts, 19, 1))
'1.0': Derived; // ok
>'1.0' : Symbol(S3['1.0'], Decl(subtypingWithObjectMembersOptionality3.ts, 25, 25))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembersOptionality3.ts, 2, 31))
}
// object literal case
var a: { Foo?: Base; }
>a : Symbol(a, Decl(subtypingWithObjectMembersOptionality3.ts, 30, 3))
>Foo : Symbol(Foo, Decl(subtypingWithObjectMembersOptionality3.ts, 30, 8))
>Base : Symbol(Base, Decl(subtypingWithObjectMembersOptionality3.ts, 0, 0))
var b: { Foo2: Derived; }
>b : Symbol(b, Decl(subtypingWithObjectMembersOptionality3.ts, 31, 3))
>Foo2 : Symbol(Foo2, Decl(subtypingWithObjectMembersOptionality3.ts, 31, 8))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembersOptionality3.ts, 2, 31))
var r = true ? a : b; // ok
>r : Symbol(r, Decl(subtypingWithObjectMembersOptionality3.ts, 32, 3))
>a : Symbol(a, Decl(subtypingWithObjectMembersOptionality3.ts, 30, 3))
>b : Symbol(b, Decl(subtypingWithObjectMembersOptionality3.ts, 31, 3))
|