diff --git a/src/services/code_action/insert_type_utils.ml b/src/services/code_action/insert_type_utils.ml index 6f9c7d10747..3b23e9c838c 100644 --- a/src/services/code_action/insert_type_utils.ml +++ b/src/services/code_action/insert_type_utils.ml @@ -1212,13 +1212,8 @@ class type_normalization_hardcoded_fixes_mapper kind, Some [(Ty.Str _ | Ty.StrLit _)] ) - when is_react_loc sym_def_loc && imports_react -> - let name = - if imports_react then - "React.MixedElement" - else - "React$MixedElement" - in + when is_react_loc sym_def_loc -> + let name = "React.MixedElement" in let symbol = { symbol with Ty.sym_name = Reason.OrdinaryName name } in this#on_t env Ty.(Generic (symbol, kind, None)) (* E.g. React$Element will become React.MixedElement or React.Node. @@ -1238,14 +1233,9 @@ class type_normalization_hardcoded_fixes_mapper when is_react_loc sym_def_loc -> let name = if generalize_react_mixed_element then - if imports_react then - "React.MixedElement" - else - "React$MixedElement" - else if imports_react then - "React.Node" + "React.MixedElement" else - "React$Node" + "React.Node" in let symbol = { symbol with Ty.sym_name = Reason.OrdinaryName name } in this#on_t env Ty.(Generic (symbol, kind, None)) diff --git a/tests/annotate_exports_react/annotate_exports_react.exp b/tests/annotate_exports_react/annotate_exports_react.exp index 671aa144c94..6be8b31f992 100644 --- a/tests/annotate_exports_react/annotate_exports_react.exp +++ b/tests/annotate_exports_react/annotate_exports_react.exp @@ -28,7 +28,7 @@ import React from 'react'; type Props = {} -export default (): React$MixedElement => { +export default (): React.MixedElement => { class Abc extends React.Component { } return ; } @@ -151,7 +151,7 @@ import React from 'react'; type Props = {} -export default (): React$MixedElement => { +export default (): React.MixedElement => { class Abc extends React.Component { } return ; } diff --git a/tests/annotate_exports_simplify_hardcoded_fixes/annotate_exports_simplify_hardcoded_fixes.exp b/tests/annotate_exports_simplify_hardcoded_fixes/annotate_exports_simplify_hardcoded_fixes.exp index fa64d7d2d9f..bfdc1a45b4e 100644 --- a/tests/annotate_exports_simplify_hardcoded_fixes/annotate_exports_simplify_hardcoded_fixes.exp +++ b/tests/annotate_exports_simplify_hardcoded_fixes/annotate_exports_simplify_hardcoded_fixes.exp @@ -6,7 +6,7 @@ declare function f(): ExactReactElement_DEPRECATED<'a'> | ExactReactElement_DEPRECATED<'b'>; -module.exports = (f() as React$MixedElement); +module.exports = (f() as React.MixedElement); >>> Launching report... @@ -42,7 +42,7 @@ Warnings: declare function f(): ExactReactElement_DEPRECATED<'a'> | ExactReactElement_DEPRECATED<'b'>; -module.exports = (f() as React$MixedElement); +module.exports = (f() as React.MixedElement); === Diff between codemod-ed & autofix-ed === diff --git a/tests/autofix_simplify_hardcoded_fixes/autofix_simplify_hardcoded_fixes.exp b/tests/autofix_simplify_hardcoded_fixes/autofix_simplify_hardcoded_fixes.exp index 9d16db2ae65..21585191b04 100644 --- a/tests/autofix_simplify_hardcoded_fixes/autofix_simplify_hardcoded_fixes.exp +++ b/tests/autofix_simplify_hardcoded_fixes/autofix_simplify_hardcoded_fixes.exp @@ -3,6 +3,6 @@ declare function f(): ExactReactElement_DEPRECATED<'a'> | ExactReactElement_DEPRECATED<'b'>; -module.exports = (f() as React$MixedElement); +module.exports = (f() as React.MixedElement); > flow status No errors!