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
When using the >> operator you cannot compose functions such as int, double, etc. When you do this, fable will not generate the js Number.parseInt call. This causes a string to be passed to the next function.
As a workaround you can compose functions together without the >> operator to generate the parse call properly.
Repro code
Probably quickest to demonstrate this via the REPL. You'll notice apply does not have Number.parseInt call, but the others do.
Description
When using the
>>
operator you cannot compose functions such asint
,double
, etc. When you do this, fable will not generate the jsNumber.parseInt
call. This causes a string to be passed to the next function.As a workaround you can compose functions together without the
>>
operator to generate the parse call properly.Repro code
Probably quickest to demonstrate this via the REPL. You'll notice
apply
does not haveNumber.parseInt
call, but the others do.http://fable.io/repl.html#?code=let%20apply%20%3A%20string%20-%3E%20Choice%3Cint%2C%20obj%3E%20%3D%20int%20%3E%3E%20Choice1Of2%0D%0Alet%20apply2%20%3A%20string%20-%3E%20Choice%3Cint%2C%20obj%3E%20%3D%20System.Int32.Parse%20%3E%3E%20Choice1Of2%0D%0Alet%20apply3%20%3A%20string%20-%3E%20Choice%3Cint%2C%20obj%3E%20%3D%20fun%20s%20-%3E%20int%20s%20%7C%3E%20Choice1Of2%0D%0A%0D%0A%0D%0A
Expected and actual results
Expected the string to be parsed into a number before being handed to the next function.
Actually passed the string, causing downstream fn errors at runtime.
Related information
The text was updated successfully, but these errors were encountered: