I'm trying to do the following in typescript:
var testHier = [
{ content:"1", opened:true, children: [
{ content:"1.1" }
]},
{ content: "2", opened:true, children: [
{ content:"2.1", opened:false, children: [
{ content:"2.1.1", value:"2.1.1" }
]},
{ content: "2.2", value: "2.2" }
]}
]
but when I compile I get the error:
"Incompatible types in array literal expression: Type '{ content: string; opened: bool; children: { content: string; value: string; }[]; }' is missing property 'value' from type '{ content: string; value: string; }'"
If I change
{ content:"2.1", opened:false, children: [
to
{ content:"2.1", opened:false, value:"foo", children: [
the error goes away.
I tested the declaration in the chrome console and it seems to work just fine. Since this is just javascript I'd expect it to get passes straight through, but that doesn't seem to be the case. Anyone know what's going on here?