Skip to content

[<ParamList>] not generating the same code if defined in a project or consume from outsideΒ #3834

@MangelMaxime

Description

@MangelMaxime

Description

According fable-compiler/fable-react#243, it looks like if a method use [<ParamList>] and we provide an empty array to it.

Then when consumed from the same project / file it will not generate the empty array arguments.

But when consumed from a referenced project (via NuGet at least) it will have the empty array generated.

Repro code

open Fable.Core

type ReactElement = obj

type IReactExports =
    /// Create and return a new React element of the given type. The type argument can be either a tag name string (such as 'div' or 'span'), a React component type (a class or a function), or a React fragment type.
    abstract createElement: comp: obj * [<ParamList>] children: ReactElement seq -> ReactElement
    // abstract createElement: comp: obj * props: obj -> ReactElement

let react : IReactExports = unbox null

let inline voidEl (tag: string) : ReactElement =
    react.createElement(tag, [])

voidEl "br" |> ignore
// From same project
react.createElement("br");

// From referenced project
react.createElement("br", []);

We should look to always generate react.createElement("br");.

Related information

  • Fable version: 4.18.0
  • Operating system: Repl

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions