I have a function drawSnake
which is called as follows:
drawSnake(
[
[0, 0],
[0, 1],
[0, 2],
[0, 3],
[0, 4],
]
);
How can I type the input for this function?
I have tried something like Array<Array<[number, number]>>
but it doesn't seem to be right.
function drawSnake(snake: ???) {
...
}
CodePudding user response:
as stated on comments (@VLAZ). You can do it like this
function drawSnake(snake: Array<[number, number]>) {
...
}
CodePudding user response:
Thanks to @VLAZ and @thedude in the comments above, this can be solved in 2 ways:
#1:
Array<[number, number]>
#2:
[number, number][]