core icon indicating copy to clipboard operation
core copied to clipboard

Give specific error on not finding proxies for decimal/bigint/Complex

Open Jand42 opened this issue 7 years ago • 2 comments

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.

Jand42 avatar Jun 15 '18 09:06 Jand42

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 avatar Oct 05 '18 15:10 granicz

@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.

Jand42 avatar Oct 05 '18 16:10 Jand42