Closed diegopego closed 1 year ago
@diegopego Thanks for testing. Indeed, decimal proxy at
needs a static Zero
property. This could work:
[<Inline>]
static member Zero: decimal = 0m
Feel free to push a PR if indeed you see it passing.
The error persisted after adding the suggested code. I googled and found this: "List.sum uses static member constraints. Static member constraints don't look into extensions methods so that's not an option." ... Use List.fold instead.
So I used and it worked.
let total = transactionItemsVar.Value
|> List.map (fun v -> v.TotaPrice)
|> List.fold (+) 0m<Money Quantity>
@diegopego I have tested above Zero
proxy now too with your test - it does work, I have pushed it now. Maybe you have not rebuilt properly, as compiler uses some special handling of WebSharper.Main.Proxies
project, you must make sure WebSharper.Main
is also rebuilt and it's best to shut down persistent compilation helper wsfscservice.exe
too.
All working! Thank you. It was my fault that it was not compiling.
To reproduce, add the following test to dotnet-websharper-core\tests\WebSharper.Tests\MathJS.fs
This throws the following error. WebSharper.Tests\MathJS.fs(309,39,309,52): warning WS9002: Could not find method for trait call: get_Zero targets: source:(() -> System.Decimal); types: System.Decimal
List.sumBy works fine with float.
I want to help solve this. I'd be glad if anyone could give me advice on it.