e.findIdx is not a function error when accessing a value in a tuple

I was trying to access a value in a tuple, but when I do, I get the “e.findIdx is not a function” error. This doesn’t happen when I do the same thing with an array, just a tuple.

Here is an example of what I’m trying to do:

let exampleTuple: [number,number] = [5,6]
let value: number = exampleTuple[0]

I honesty have no clue what is wrong. All help is appreciated.

This is usually a typing issue so throwing casts at it should eventually fix it.

let exampleTuple: [number,number] = [5,6]
let value: number = (exampleTuple as any[])[0]

Here you cast the tuple to an any array before accessing it. Didn’t test it but it should work

2 Likes

Worked like a charm! Thank you very much :slight_smile:.

1 Like