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 jsOptions with an interface, a non-property member (one missing a getter or setting) generates invalid js, a local FSharpRef that references a non-existent identifier copyOfStruct.
Repro code
openFable.Core.JsInteroptypeResponse=abstract fn: int -> int
abstract fnProp:(int -> int)with get, set
abstract prop: bool with get, set
letres= jsOptions<Response>(fun o ->
o.fn <-(fun i -> i)
o.fnProp <-(fun i -> i)
o.prop <-false)
I can't remember if Is abstract fn: int -> int equivalent to abstract fn: int -> int with get, set in F#?
I guess it is because the F# compiler don't complains during compilation.
For as long, as I remember we always recommended to use with get, set on interfaces used for POJO. However, I don't know if there is a reason for that or if supporting cases without with get, set has just been forgotten.
Adding parens around the function type turns it from a plain member into a gettable property, which causes a compilation error in the example below since there's no setter defined. So it likes like a missing validation to me.
typeResponse=abstract fn: int -> int
abstract fn2:(int -> int)abstract fn3:(int -> int)with set
abstract fnProp:(int -> int)with get, set
abstract prop: bool with get, set
letres= jsOptions<Response>(fun o ->
o.fn <-(fun i -> i)// this line fails to compile
o.fn2 <-(fun i -> i)
o.fn3 <-(fun i -> i)
o.fnProp <-(fun i -> i)
o.prop <-false)
Description
When using
jsOptions
with an interface, a non-property member (one missing a getter or setting) generates invalid js, a local FSharpRef that references a non-existent identifiercopyOfStruct
.Repro code
Related information
The text was updated successfully, but these errors were encountered: