-2

I want to declare a variable that is an object filled with arrays of objects for example:

let obj = {
    "page1"     : [ {x: 1, y: 2}, {x: 2, y: 5} ],
    "page2"     : [ {x: 1, y: 2}, {x: 2, y: 5} ],
    "dsfsfffsfs": [ {x: 1, y: 2}, {x: 2, y: 5} ]
}

How can I declare that as an interface in typescript?

1
  • This would look to be quite trivial... what difficulties are you running into in writing it yourself? Commented Oct 8, 2022 at 0:15

1 Answer 1

0

for useState and React, try this:

export interface Obj {
  x: number;
  y: number;
}

and then:

 const [objList, setObjList] = useState<Obj[]>([]);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.