I am currently working with a product model that looks like this:
export class Product {
id: number;
name: string;
price: number;
url: string;
description: string;
constructor() {
this.id = 1;
this.name = '';
this.price = 0.0;
this.url = '';
this.description = '';
}
}
My goal is to create a map similar to a data structure where I can use the Product id as a key and retrieve a structure containing the product itself along with its quantity.
In Java, this would be achieved using:
Map<Integer, Pair<Product, Integer>> = new HashMap<>();
Now, my question is how can I implement the same functionality using TypeScript?