Skip to content

Commit a551b69

Browse files
jbrown215facebook-github-bot
authored andcommitted
[flow] add configurability to data prop values
Summary: Changelog: [internal] Reviewed By: gkz Differential Revision: D69404375 fbshipit-source-id: 89b2e591b0ee2fb6dcba9c0fe64477557bbd0093
1 parent 8c3a41c commit a551b69

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/react-dom.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,9 @@ type ReactDOM$HTMLElementProps = {|
862862
// Override this if you want to add custom props to all HTML elements
863863
type ReactDOM$CustomHTMLElementProps = $ReadOnly<{||}>;
864864

865+
// Override this if you want to change the types accepted by data-prefixed props
866+
type ReactDOM$DataPropValues = ?(string | boolean | number);
867+
865868
// Self closing tags, like br, do not allow children
866869
type ReactDOM$SelfClosingHTMLElementProps = Omit<
867870
ReactDOM$HTMLElementProps,
@@ -874,7 +877,7 @@ type ReactDOM$HTMLElementJSXIntrinsicTyped<Props, Instance = HTMLElement> = {|
874877
...Props,
875878
...ReactDOM$EventHandlers<Instance>,
876879
// We add data props here to avoid spreading errors
877-
[StringPrefix<'data-'>]: ?(string | boolean | number),
880+
[StringPrefix<'data-'>]: ReactDOM$DataPropValues,
878881
},
879882
|};
880883

0 commit comments

Comments
 (0)