core
core copied to clipboard
Give specific error on not finding proxies for decimal/bigint/Complex
These are the 3 numeric types that are proxied outside of WebSharper.Main: by WebSharper.MathJS which is in a separate nuget package. Compiler could give error telling to include that package reference when using those types instead of the usual "not found in JavaScript compilation" error.
I am getting this when trying to use a decimal in an RPC:
WebSharper.Main.js?h=1127374076:269 Uncaught TypeError: Cannot read property 'CreateDecimalBits' of undefined
at decode (WebSharper.Main.js?h=1127374076:269)
at Object.Arrays.map (WebSharper.Main.js?h=1127374076:2364)
at Object.Json.shallowMap (WebSharper.Main.js?h=1127374076:316)
at decode (WebSharper.Main.js?h=1127374076:255)
at Object.Arrays.map (WebSharper.Main.js?h=1127374076:2364)
at Object.Json.shallowMap (WebSharper.Main.js?h=1127374076:316)
at decode (WebSharper.Main.js?h=1127374076:258)
at Object.Json.Activate (WebSharper.Main.js?h=1127374076:310)
at WebSharper.Main.js?h=1127374076:430
at XMLHttpRequest.k (WebSharper.Main.js?h=1127374076:482)
@granicz Thanks, this shows that if decimal is not used in the client-side, other than receiving it as an RPC result, this is currently not caught by the compiler but results in a run-time error.
Adding reference to WebSharper.MathJS package should resolve this.