Rescript react ariaLabel prop is not getting transformed to "aria-label" in tsx
srikanthkyatham opened this issue · comments
Hi
I am using
"rescript": "^9.1.2",
"gentype": "^4.0.0"
When I write the binding like the following
module Tracker = { @genType.import(("tracker", "Tracker")) @react.component external make: ( ~ariaLabel: string=?, ) => React.element = "Tracker" }
The generated gen.tsx is
export const TrackerTypeChecked: React.ComponentType<{ readonly ariaLabel?: string }> = TrackerNotChecked;
I am expecting the gen.tsx to be
export const TrackerTypeChecked: React.ComponentType<{ readonly "aria-label"?: string }> = TrackerNotChecked;
I have followed the guidelines here https://rescript-lang.org/docs/react/latest/components-and-props#handling-invalid-prop-names-eg-keywords
DId I miss anything, please help
I'm not sure the generated .bs.js
treats aria the way you'd like to begin with.
It does treat aria in a special way when used for <div ariaLabel="..." />
, not sure about externals.
Can you add some code that uses those externals see what the .bs.js
for the use looks like?
Hi @cristianoc
Here is the bs.js
React.createElement("header", undefined, React.createElement(Tracker.make, { currentStep: currentStep, steps: 5, ariaLabel: "tracker" })), React.createElement("main", undefined, children)); }
See: "ariaLabel" is not modified in the JS.
Hi
Yes I see it is not modified any other alternative approaches to this issue
Can you ask in the forum? So the answer will be available to others.
This is not about genType.
Sure thanks I will