Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MangelMaxime opened this issue Jun 7, 2024 · 0 comments

Comments

@MangelMaxime
Copy link
Member

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant