Closed cristianoc closed 1 year ago
Another magic would solve the key props issue here 👍
This would be so great for the React Native bindings!
Currently the props of View
need to be repeated for all subclasses of View
, see e.g. https://github.com/rescript-react-native/rescript-react-native/blob/4f04d7788829f4764ca570ec3920f24b8c149568/src/components/Slider.res#L21.
Having
module Slider = {
type props = {
...View.props,
disabled?: bool,
maximumTrackImage?: bool,
// ... more slider props ...
}
@module("react-native")
external make: props => React.element = "Slider"
}
instead would be a huge win!
/cc @MoOx
I wish we could extend the parse tree and this would be some clean extension. Instead, one would have to find a representation using the existing AST. For instance, a fake field called "...". Other than that, the type checking extension should not be difficult.
Not sure, but isn't it workable with
Deleted a confused comment.label_declaration
and attribute something @spread
?
type extended = {...t, x:string}
as an abbreviation instead of repeating the field of the type definition oft
.