Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.

Commit a1f4593

Browse files
miorelfacebook-github-bot
authored andcommitted
React.Element<any> / React.Element<*> -> React.Node as much as possible
Summary: Most of the time when people annotate something with `React.Element<any>` or `React.Element<*>` they don't really care about it really being a React element, and would be just as happy with `React.Node`. The exceptions I encountered when writing this diff were: 1) places where people do `React.cloneElement` -- in that case we of course need an element 2) components that want some of the props or children to be a certain component type -- but in those cases we ought to specify the type of element rather than accepting `any` or `*` As such, it's reasonable to replace `React.Element<any>` and `React.Element<*>` if doing so does not cause any Flow errors, and this should put a noticeable dent in our usage of unsafe Flow types. Reviewed By: camspiers, stryju Differential Revision: D7810983 fbshipit-source-id: d28f645a63cdfbae74370817e36c5bf590f543d6
1 parent d2a3ae8 commit a1f4593

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/component/base/DraftEditor.react.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ class DraftEditor extends React.Component<DraftEditorProps, State> {
286286
);
287287
}
288288

289-
_renderPlaceholder(): ?React.Element<any> {
289+
_renderPlaceholder(): React.Node {
290290
if (this._showPlaceholder()) {
291291
const placeHolderProps = {
292292
text: nullthrows(this.props.placeholder),

src/component/contents/DraftEditorBlock.react.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class DraftEditorBlock extends React.Component<Props> {
134134
}
135135
}
136136

137-
_renderChildren(): Array<React.Element<any>> {
137+
_renderChildren(): Array<React.Node> {
138138
const block = this.props.block;
139139
const blockKey = block.getKey();
140140
const text = block.getText();

src/model/decorators/DraftDecorator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export type DraftDecorator = {
5353
*/
5454
export type DraftDecoratorComponentProps = {
5555
blockKey: BlockNodeKey,
56-
children?: Array<React.Element<any>>,
56+
children?: Array<React.Node>,
5757
contentState: ContentState,
5858
decoratedText: string,
5959
dir: ?HTMLDir,

src/model/immutable/DraftBlockRenderConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414

1515
export type DraftBlockRenderConfig = {
1616
element: string,
17-
wrapper?: React$Element<any>,
17+
wrapper?: React.Node,
1818
aliasedElements?: Array<string>,
1919
};

0 commit comments

Comments
 (0)