[Question] How to properly interop with typescript/flow Map and Set

In javascript we have the Map and Set objects natively, and Typescript and Flow have definitions for those types (e.g. fun(arg: Map<number, string>, arg2: Set<string>).

In rescript I can’t find this types under the Js module, the closest one would be Js.Dict but it maps to a plain javascript object which is not what I look for.

The other similar option would be to use Belt, it has
some cool data structures like Map, Set, Queue, …
however they don’t map directly to Map or Set in typescript. We would require to create definition files for them, I wonder if they already exist ? :thinking:
Or do I have to manually create them ? trying to guess if I wrote the definition files correctly from what I understand from the untyped code of Belt library ?

AFAIK there are no bindings for Map and Set in the standard library, but I think you can use https://github.com/bloodyowl/rescript-js for that.

3 Likes