157 lines
2.5 KiB
Text
157 lines
2.5 KiB
Text
|
=== tests/cases/compiler/arrayLiteralTypeInference.ts ===
|
||
|
class Action {
|
||
|
>Action : Action
|
||
|
|
||
|
id: number;
|
||
|
>id : number
|
||
|
}
|
||
|
|
||
|
class ActionA extends Action {
|
||
|
>ActionA : ActionA
|
||
|
>Action : Action
|
||
|
|
||
|
value: string;
|
||
|
>value : string
|
||
|
}
|
||
|
|
||
|
class ActionB extends Action {
|
||
|
>ActionB : ActionB
|
||
|
>Action : Action
|
||
|
|
||
|
trueNess: boolean;
|
||
|
>trueNess : boolean
|
||
|
}
|
||
|
|
||
|
var x1: Action[] = [
|
||
|
>x1 : Action[]
|
||
|
>Action : Action
|
||
|
>[
|
||
|
{ id: 2, trueness: false },
|
||
|
{ id: 3, name: "three" }
|
||
|
] : Action[]
|
||
|
|
||
|
{ id: 2, trueness: false },
|
||
|
>{ id: 2, trueness: false } : { id: number; trueness: boolean; }
|
||
|
>id : number
|
||
|
>trueness : boolean
|
||
|
|
||
|
{ id: 3, name: "three" }
|
||
|
>{ id: 3, name: "three" } : { id: number; name: string; }
|
||
|
>id : number
|
||
|
>name : string
|
||
|
|
||
|
]
|
||
|
|
||
|
var x2: Action[] = [
|
||
|
>x2 : Action[]
|
||
|
>Action : Action
|
||
|
>[
|
||
|
new ActionA(),
|
||
|
new ActionB()
|
||
|
] : Action[]
|
||
|
|
||
|
new ActionA(),
|
||
|
>new ActionA() : ActionA
|
||
|
>ActionA : typeof ActionA
|
||
|
|
||
|
new ActionB()
|
||
|
>new ActionB() : ActionB
|
||
|
>ActionB : typeof ActionB
|
||
|
|
||
|
]
|
||
|
|
||
|
var x3: Action[] = [
|
||
|
>x3 : Action[]
|
||
|
>Action : Action
|
||
|
>[
|
||
|
new Action(),
|
||
|
new ActionA(),
|
||
|
new ActionB()
|
||
|
] : Action[]
|
||
|
|
||
|
new Action(),
|
||
|
>new Action() : Action
|
||
|
>Action : typeof Action
|
||
|
|
||
|
new ActionA(),
|
||
|
>new ActionA() : ActionA
|
||
|
>ActionA : typeof ActionA
|
||
|
|
||
|
new ActionB()
|
||
|
>new ActionB() : ActionB
|
||
|
>ActionB : typeof ActionB
|
||
|
|
||
|
]
|
||
|
|
||
|
var z1: { id: number }[] =
|
||
|
>z1 : { id: number; }[]
|
||
|
>id : number
|
||
|
|
||
|
[
|
||
|
>[
|
||
|
{ id: 2, trueness: false },
|
||
|
{ id: 3, name: "three" }
|
||
|
] : { id: number; }[]
|
||
|
|
||
|
{ id: 2, trueness: false },
|
||
|
>{ id: 2, trueness: false } : { id: number; trueness: boolean; }
|
||
|
>id : number
|
||
|
>trueness : boolean
|
||
|
|
||
|
{ id: 3, name: "three" }
|
||
|
>{ id: 3, name: "three" } : { id: number; name: string; }
|
||
|
>id : number
|
||
|
>name : string
|
||
|
|
||
|
]
|
||
|
|
||
|
var z2: { id: number }[] =
|
||
|
>z2 : { id: number; }[]
|
||
|
>id : number
|
||
|
|
||
|
[
|
||
|
>[
|
||
|
new ActionA(),
|
||
|
new ActionB()
|
||
|
] : { id: number; }[]
|
||
|
|
||
|
new ActionA(),
|
||
|
>new ActionA() : ActionA
|
||
|
>ActionA : typeof ActionA
|
||
|
|
||
|
new ActionB()
|
||
|
>new ActionB() : ActionB
|
||
|
>ActionB : typeof ActionB
|
||
|
|
||
|
]
|
||
|
|
||
|
var z3: { id: number }[] =
|
||
|
>z3 : { id: number; }[]
|
||
|
>id : number
|
||
|
|
||
|
[
|
||
|
>[
|
||
|
new Action(),
|
||
|
new ActionA(),
|
||
|
new ActionB()
|
||
|
] : { id: number; }[]
|
||
|
|
||
|
new Action(),
|
||
|
>new Action() : Action
|
||
|
>Action : typeof Action
|
||
|
|
||
|
new ActionA(),
|
||
|
>new ActionA() : ActionA
|
||
|
>ActionA : typeof ActionA
|
||
|
|
||
|
new ActionB()
|
||
|
>new ActionB() : ActionB
|
||
|
>ActionB : typeof ActionB
|
||
|
|
||
|
]
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|