Skip to content

@as with "@react.component external" silently ignored in v12.0.0-beta.2 when some 3rdparty ppx is loaded #7753

@reebalazs

Description

@reebalazs
  • Is it a bug? Usage questions should often be asked in the forum instead.
  • Concise, focused, friendly issue title & description.
  • A minimal, reproducible example.
  • OS and browser versions, if relevant.
  • Is it already fixed in master? Instructions

This happens in v12.0.0-beta.4. I noticed this when migrating my code from v11 to v12.

Minimal code as follows:

Define an external component with a parameter using @as:

  module Xxx = {
    @react.component
    external make: (@as("something") ~foo: string) => React.element = "myfunc"
  }

Then use it:

  <Xxx foo="bar" />

This compiles to the following with no error message:

          JsxRuntime.jsx(myfunc, {
            foo: "bar"
          }),

This compiled in v11 to the following. In my opinion this should be still the correct result. (I am not aware of @as being deprecated in external react components, but if so then an error would be appropriate)

          JsxRuntime.jsx(myfunc, {
            something: "bar"
          }),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions