1
interface ChatRoom {
  [key: number]: array;
}

Is there a way to declare 2dimensional array like a snippet I've provided? The key must be number and the value must be array. Is there any other way to declare that array? Thanks in advance.

1 Answer 1

1

type ChatRoom = any[][];

or

type ChatRoom = Array<Array<any>>;

Change any for your desired type.

Sign up to request clarification or add additional context in comments.

3 Comments

Does "any" take an array? I thought it takes only single object.
It takes anything you want. But it's already 2-dimension. Do you want 2-dimension holding a 3rd array?
Thanks for feedback, I've already solved this problem. I realized that I needed object with 2 dimensional array within and with key: number.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.