Skip to content

[JS] JsInterop.jsOptions produces unexpected output for nested types #4010

Closed
@Linschlager

Description

@Linschlager

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

open Fable.Core

[<AllowNullLiteral>]
type MyInnerType =
  abstract member value: int with get, set

[<AllowNullLiteral>]
type MyOuterType =
  abstract member nested: MyInnerType with get, set

let x = JsInterop.jsOptions<MyOuterType> (fun o ->
  o.nested.value <- 10
)

Actual output

export const x = {
    value: 10,
};

Expected output

export const x = {
    nested = {
        value: 10,
    }
};

or compilation error

Related information

  • REPL: 4.2.0
  • Fable: 4.23.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions