In this Typescript/Javascript code:
var v= {
x: 1,
y: {
z: v.x,
}
}
const c = {
x: 1,
y: {
z: c.x,
}
}
v is ok because var
is JavaScript and it doesn't complain, but when assigning z in c there is an error because of the use of z before its declaration.
My question: is there a way to get it? (I know I could declare another x out of c and assign its value inside, but I mean something more direct)