reasonml / reason-react

Reason bindings for ReactJS

Home Page:https://reasonml.github.io/reason-react/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

external call `type_` not renamed to `type`

elnygren opened this issue · comments

commented
module Button = {
  [@bs.module "../Button"] [@react.component]
  external make:
    (
      ~type_: [@bs.string] [ | `grey | `primary], // <- I'm talking about this arg name
    ) => React.element = "default";
};

with type_ I get .bs.js with
React.createElement(Button.default, {type_: ...
with _type it is indeed
React.createElement(Button.default, {type:...

bs-platform '5.0.6', reason-react 0.7.0... could reason react native have something to do with this?

I find this behavior a bit nonintuitive because for regular dom elements it's type_ and not _type; eg. <input type_="text" />

Also the docs are not helpful in this scenario https://reasonml.github.io/reason-react/docs/en/invalid-prop-name

commented

The analogue is actually this:

type t = {. "type_": int};

let foo = (x: t) => x##type_;

Where type_ stays the same in the generated output.

The alternatives are _type and type__, which follow the Object label translation convention above.

Hey @elnygren,

In an effort to clean up the repo (and given how old this issue is) I'm going to close this out for now.

Sorry about the delay. Please re-open if its still relevant.

Thanks!