Answer the question
In order to leave comments, you need to log in
Typescript, map() method, interfaces?
Hello.
Wrote an interface, initialized an array of objects using it. Now I'm trying to iterate it with the map() method. But I am getting an error
Property 'map' does not exist on type 'Itemp'.ts(2339)
interface Itemp {
[index: number]: { x: number; y: number };
}
const temp: Itemp = [{ x: 1, y: 2 }, { x: 3, y: 4 }, { x: 5, y: 6 }];
const temp2: any = temp.map((item: { x: number; y: number }) => item);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question