javascript - Typescript create new map<String, List<String>> - Stack Overflow

admin2025-04-10  0

I'm trying to create a new Map in Typescript like this: Map<String, List < String > >. Something like (this example is in java):

private map<String, List<String>> map = HashMap<String, ArrayList<String>();

Until now my code is:

myMap=new Map();

I tried different approaches but it doesn't work. How it can be done?

I'm trying to create a new Map in Typescript like this: Map<String, List < String > >. Something like (this example is in java):

private map<String, List<String>> map = HashMap<String, ArrayList<String>();

Until now my code is:

myMap=new Map();

I tried different approaches but it doesn't work. How it can be done?

Share Improve this question edited Sep 14, 2021 at 12:27 denisiulian asked Sep 14, 2021 at 12:18 denisiuliandenisiulian 2738 silver badges20 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8
const categoryMap = new Map<string, string[]>();

or

const categoryMap: Map<string, string[]> = new Map();
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1744257958a238407.html

最新回复(0)