I’m trying to use a React component that has a property named type. ReScript won’t let me use that. I can only use type_. Here is my workaround. This works but I’d prefer not to use a reserved keyword.
I think the vs code extension automatically turned it into type_ not _type. Is this a bug? Actually I will check if I typed it wrong - not sure. Still don’t know why the decorator didn’t work. Finally I’m not sure what you’re describing is documented anywhere - I didn’t find it but did find the escape hatch mechanism for using keywords and the usage was discouraged- hence my question on this forum. Something needs improvement here.
It’s definitely not the easiest to understand part of the language. Since it’s inherently weird, I am not sure how to document it properly nowadays.
The decorators only work on record attributes — not on labeled arguments, nor on structural object attributes (@react.component annotated make functions turn labeled arguments into a structural object).