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
JsInterop.jsOptions compiles to a js record containing the specified fields. This works nicely for simple interfaces, however it behaves unexpectedly with nested ones.
openFable.Core[<AllowNullLiteral>]typeMyInnerType=abstractmembervalue:intwith get, set
[<AllowNullLiteral>]typeMyOuterType=abstractmembernested:MyInnerTypewith get, set
letx= JsInterop.jsOptions<MyOuterType>(fun o ->
o.nested.value <-10)
Actual output
exportconstx={value: 10,};
Expected output
exportconstx={
nested ={value: 10,}};
or compilation error
Related information
REPL: 4.2.0
Fable: 4.23.0
The text was updated successfully, but these errors were encountered:
I think you are supposed to call jsOptions again for the inner type:
openFable.CoreopenFable.Core.JsInterop[<AllowNullLiteral>]typeMyInnerType=abstractmembervalue:intwith get, set
[<AllowNullLiteral>]typeMyOuterType=abstractmembernested:MyInnerTypewith get, set
letx= jsOptions<MyOuterType>(fun o ->
o.nested <- jsOptions<MyInnerType>(fun o ->
o.value <-10))
exportconstx={nested: {value: 10,},};
Perhaps, it is possible to make jsOptions works the way you shown but this will need to be investigated as I am not familiar with that part of the code yet.
@MangelMaxime Yes, that was my conclusion as well and that works nicely, however it is a bit more verbose.
It mostly seemed like unexpected behaviour which is why I reported it here.
Description
JsInterop.jsOptions
compiles to a js record containing the specified fields. This works nicely for simple interfaces, however it behaves unexpectedly with nested ones.REPL
Repro code
Actual output
Expected output
or compilation error
Related information
The text was updated successfully, but these errors were encountered: