#Property 'node' does not exist on type 'number[]'

5 messages · Page 1 of 1 (latest)

zinc raptor
#

Hi guys, I have a structure such as the screenshot (i want to access the previous array entry in a map)

The issue is that when i do this, i get Property 'node' does not exist on type 'number[]'.ts(2339)

I feel as if I need to reapproach this or somehow use as to ensure the inferred type is correct, am i wrong?

My data structure is generated from relay and is shown in the screenshot

Ty :)

violet abyss
#

you're missing a ., it's ...edges?.[index - 1].node...

#

because that . is missing, it turns into a ternary, data.edges ? [index - 1].node?.dateOfMove with the ifFalse clause missing
that's where the number[] in the error comes from

zinc raptor
#

Ugh slow day

#

thanks @violet abyss