Make usage of `_` in object keys consistent between external and JSX
JSX:
<button type_="button" />
Compiles to:
var React = require("react");
React.createElement("button", {
type: "button"
});
external:
type t;
[@bs.obj] external make: (~_type: string) => t = "";
let x = make(~_type="x");
Compiles to:
var x = {
type: "x"
};
But when bindings to React components meet external, it's required to use prefix form:
module X = {
[@react.component] [@bs.module "x"]
external make: (~_type: string) => React.element = "X";
};
So on the call site it's:
<button type_="button" />
<X _type="x" />
Is this your desired behavior or current behavior? It is a bit strange to me where such name mangling happens
JSX:
<button type_="button" />
Compiles to:
var React = require("react");
React.createElement("button", {
type: "button"
});
This is the current behavior.
The desired one is:
type t;
[@bs.obj] external make: (~type_: string) => t = "";
let x = make(~type_="x");
Would compile to:
var x = {
type: "x"
};
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Not stale.
The issue is solved.