Open leononame opened 11 months ago
Thanks for opening this issue. I think this should be possible. We have those interfaces for Python (almost) so should be possible for TypeScript as well. Let me have a look ...
@dbrattli Hi, sorry for bothering again. Did you have any success, it's kind of a blocking issue for me at the moment. I'd be happy to help out as well if I can, but maybe you could give me a pointer on where to start?
Description
I understand it's not part of the F# core library and isn't covered in the docs either, but IReadOnlyDictionary and IDictionary are abstractions around types that are covered by Fale (Dictionary and Map) and are well integrated with F# using
dict
andreadOnlyDict
. In TypeScript, the types compile to any, which makes it impossible to use it under certain circumstances.Repro code
results in this TypeScript code:
However,
return getItemFromDict(dict_1, value_1).A;
is an error in TypeScript (TS2571: Object is of type unknown
). I understand thatIDictionary
is more complicated because it has a bigger surface, but compilingIReadOnlyDicitionary
to something similar to whatIMap
is in TypeScript should be possible, right?