Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Changing the type of a number fails most of the times #963
If one tries to convert a number to another type, Websharper fails with an error like this one:
Looks like that there is no complete support for all number types.
These errors are from missing proxies (JS implementations) for F# helper functions in the
[<Proxy "Microsoft.FSharp.Core.Operators, FSharp.Core">] module internal OperatorsProxy = [<Macro(typeof<WebSharper.Core.Macros.Conversion>)>] let ToByte (x: 'T) = X<byte>
Actually there is support for all standard numeric types with some caveats.
Proposal: adding overflow checks to every small type on conversions but not on arithmetic could be a good tradeoff, not littering translated code unnecessary with checks but giving the expected results when using conversions to smaller types explicitly.