You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Casting a .NET Dictionary to an ICollection emits .push for .Add, but a JS Map has no .push member.
openSystem.Collections.Genericletdic= Dictionary<int,string>()letcoll= dic :> ICollection<KeyValuePair<_,_>>letkv= KeyValuePair(1,"a")
coll.Add(kv)// emits .push on a JS Map, but Map has no .push member
But when doing the cast to ICollection Fable can't do the replacement, because the concrete type of ICollection can be anything. I think the path to fix this issue is to rework how Dictionary<'Key, 'Value> works and instead of using JS.Map directly, we should extends it:
classExtendedMapextendsMap{constructor(){super();}add(key,value){// This will replace the call to `addToDict`// ...}}
In theory, it means that the new Map class will keep fulfilling the following statement from Fable
If people compare the constructor there will be issues, but the existing API should keep working.
Casting a .NET
Dictionary
to anICollection
emits.push
for.Add
, but a JS Map has no.push
member.REPL
fable 4.21
The text was updated successfully, but these errors were encountered: