TypeScript/tests/baselines/reference/arrayLiteralTypeInference.types

145 lines
2.7 KiB
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/compiler/arrayLiteralTypeInference.ts ===
class Action {
>Action : Action
2014-08-15 23:33:16 +02:00
id: number;
>id : number
2014-08-15 23:33:16 +02:00
}
class ActionA extends Action {
>ActionA : ActionA
>Action : Action
2014-08-15 23:33:16 +02:00
value: string;
>value : string
2014-08-15 23:33:16 +02:00
}
class ActionB extends Action {
>ActionB : ActionB
>Action : Action
2014-08-15 23:33:16 +02:00
trueNess: boolean;
>trueNess : boolean
2014-08-15 23:33:16 +02:00
}
var x1: Action[] = [
>x1 : Action[]
>Action : Action
>[ { id: 2, trueness: false }, { id: 3, name: "three" }] : ({ id: number; trueness: boolean; } | { id: number; name: string; })[]
2014-08-15 23:33:16 +02:00
{ id: 2, trueness: false },
>{ id: 2, trueness: false } : { id: number; trueness: boolean; }
>id : number
2015-04-13 21:36:11 +02:00
>2 : number
>trueness : boolean
2015-04-13 21:36:11 +02:00
>false : boolean
2014-08-15 23:33:16 +02:00
{ id: 3, name: "three" }
>{ id: 3, name: "three" } : { id: number; name: string; }
>id : number
2015-04-13 21:36:11 +02:00
>3 : number
>name : string
2015-04-13 21:36:11 +02:00
>"three" : string
2014-08-15 23:33:16 +02:00
]
var x2: Action[] = [
>x2 : Action[]
>Action : Action
>[ new ActionA(), new ActionB()] : (ActionA | ActionB)[]
2014-08-15 23:33:16 +02:00
new ActionA(),
>new ActionA() : ActionA
>ActionA : typeof ActionA
2014-08-15 23:33:16 +02:00
new ActionB()
>new ActionB() : ActionB
>ActionB : typeof ActionB
2014-08-15 23:33:16 +02:00
]
var x3: Action[] = [
>x3 : Action[]
>Action : Action
2014-08-22 03:39:46 +02:00
>[ new Action(), new ActionA(), new ActionB()] : Action[]
2014-08-15 23:33:16 +02:00
new Action(),
>new Action() : Action
>Action : typeof Action
2014-08-15 23:33:16 +02:00
new ActionA(),
>new ActionA() : ActionA
>ActionA : typeof ActionA
2014-08-15 23:33:16 +02:00
new ActionB()
>new ActionB() : ActionB
>ActionB : typeof ActionB
2014-08-15 23:33:16 +02:00
]
var z1: { id: number }[] =
>z1 : { id: number; }[]
>id : number
2014-08-15 23:33:16 +02:00
[
>[ { id: 2, trueness: false }, { id: 3, name: "three" } ] : ({ id: number; trueness: boolean; } | { id: number; name: string; })[]
2014-08-15 23:33:16 +02:00
{ id: 2, trueness: false },
>{ id: 2, trueness: false } : { id: number; trueness: boolean; }
>id : number
2015-04-13 21:36:11 +02:00
>2 : number
>trueness : boolean
2015-04-13 21:36:11 +02:00
>false : boolean
2014-08-15 23:33:16 +02:00
{ id: 3, name: "three" }
>{ id: 3, name: "three" } : { id: number; name: string; }
>id : number
2015-04-13 21:36:11 +02:00
>3 : number
>name : string
2015-04-13 21:36:11 +02:00
>"three" : string
2014-08-15 23:33:16 +02:00
]
var z2: { id: number }[] =
>z2 : { id: number; }[]
>id : number
2014-08-15 23:33:16 +02:00
[
>[ new ActionA(), new ActionB() ] : (ActionA | ActionB)[]
2014-08-15 23:33:16 +02:00
new ActionA(),
>new ActionA() : ActionA
>ActionA : typeof ActionA
2014-08-15 23:33:16 +02:00
new ActionB()
>new ActionB() : ActionB
>ActionB : typeof ActionB
2014-08-15 23:33:16 +02:00
]
var z3: { id: number }[] =
>z3 : { id: number; }[]
>id : number
2014-08-15 23:33:16 +02:00
[
2014-10-13 15:56:58 +02:00
>[ new Action(), new ActionA(), new ActionB() ] : Action[]
2014-08-15 23:33:16 +02:00
new Action(),
>new Action() : Action
>Action : typeof Action
2014-08-15 23:33:16 +02:00
new ActionA(),
>new ActionA() : ActionA
>ActionA : typeof ActionA
2014-08-15 23:33:16 +02:00
new ActionB()
>new ActionB() : ActionB
>ActionB : typeof ActionB
2014-08-15 23:33:16 +02:00
]