From 3ed06b5fce77dff2e9bfe6214cb0e8577c05a247 Mon Sep 17 00:00:00 2001 From: Sam Zhou Date: Fri, 6 Dec 2024 11:54:52 -0800 Subject: [PATCH] [flow] Kill `React.Config` Summary: Changelog: [errors] `React.Config` type, deprecated in v0.254, is now removed. Reviewed By: jbrown215 Differential Revision: D66886469 fbshipit-source-id: de1e575e63c8626e6f6decd89dd6b5fb7a8e8f20 --- lib/react.js | 23 -- src/common/errors/error_codes.ml | 2 - src/common/reason.ml | 6 +- src/common/reason.mli | 1 - src/common/ty/ty.ml | 4 - src/parser_utils/type_sig/type_sig.ml | 5 - src/parser_utils/type_sig/type_sig_parse.ml | 8 - src/typing/debug_js.ml | 8 - src/typing/default_resolve.ml | 1 - src/typing/errors/error_message.ml | 18 -- src/typing/errors/flow_intermediate_error.ml | 1 - .../errors/flow_intermediate_error_types.ml | 1 - src/typing/flow_js.ml | 5 - src/typing/implicit_instantiation.ml | 3 +- src/typing/react_kit.ml | 23 -- src/typing/ty_normalizer.ml | 7 +- src/typing/type.ml | 2 - src/typing/type_annotation.ml | 26 --- src/typing/type_mapper.ml | 6 - src/typing/type_sig_merge.ml | 7 - src/typing/type_visitor.ml | 1 - .../autocomplete_react/autocomplete_react.exp | 4 - .../badly_positioned_react.exp | 4 +- .../component_syntax_unsupported.exp | 8 +- tests/component_type/component_type.exp | 8 +- .../internal_type_lint/internal_type_lint.exp | 24 +- tests/internal_type_lint/test.js | 16 +- tests/new_generics/new_generics.exp | 4 +- tests/react/react.exp | 220 +++++++++--------- tests/react_16_3/react_16_3.exp | 8 +- tests/react_16_6/react_16_6.exp | 76 +++--- tests/react_16_9/react_16_9.exp | 28 +-- tests/react_children/react_children.exp | 4 +- .../react_clone_element.exp | 196 ++++++++-------- .../react_experimental/react_experimental.exp | 24 +- tests/react_imports/react_imports.exp | 8 +- tests/type_at_pos_jsx/type_at_pos_jsx.exp | 4 +- tests/type_at_pos_react/type_at_pos_react.exp | 14 +- .../type_at_pos_type_destructors.exp | 4 +- website/docs/react/types.md | 2 +- 40 files changed, 324 insertions(+), 490 deletions(-) diff --git a/lib/react.js b/lib/react.js index e740a5aa79b..95915eb6d28 100644 --- a/lib/react.js +++ b/lib/react.js @@ -240,7 +240,6 @@ declare namespace React { type ElementProps = React$ElementProps; type ElementConfig = React$ElementConfig; type ElementRef = React$ElementRef; - type Config = React$Config; type ChildrenArray<+T> = $ReadOnlyArray> | T; type ReactSetStateFunction = ((S => S) | S) => void; @@ -386,17 +385,6 @@ declare module react { declare export type ElementProps = React$ElementProps; declare export type ElementConfig = React$ElementConfig; declare export type ElementRef = React$ElementRef; - /** - * @deprecated This type is only useful for legacy class components. You can create your - * own equivalent type with - * - * ```js - * type ReactConfigShim = $ReadOnly<{ - * ...Omit>, ...Partial - * }>; - * ``` - */ - declare export type Config = React$Config; declare interface Thenable { then( @@ -1040,17 +1028,6 @@ declare module react { type ElementProps = React$ElementProps; type ElementConfig = React$ElementConfig; type ElementRef = React$ElementRef; - /** - * @deprecated This type is only useful for legacy class components. You can create your - * own equivalent type with - * - * ```js - * type ReactConfigShim = $ReadOnly<{ - * ...Omit>, ...Partial - * }>; - * ``` - */ - type Config = React$Config; type ChildrenArray<+T> = $ReadOnlyArray> | T; type ReactSetStateFunction = ((S => S) | S) => void; diff --git a/src/common/errors/error_codes.ml b/src/common/errors/error_codes.ml index 1091c79590d..f55247ca782 100644 --- a/src/common/errors/error_codes.ml +++ b/src/common/errors/error_codes.ml @@ -96,7 +96,6 @@ type error_code = | InvalidModule | InvalidPropertyTypeArg | InvalidPropType - | InvalidReactConfig | InvalidReactCreateElement | InvalidRendersTypeArgument | InvalidSupportsPlatformDecl @@ -309,7 +308,6 @@ let string_of_code : error_code -> string = function | InvalidModule -> "invalid-module" | InvalidPropertyTypeArg -> "invalid-property-type-arg" | InvalidPropType -> "invalid-prop-type" - | InvalidReactConfig -> "invalid-react-config" | InvalidReactCreateElement -> "invalid-react-create-element" | InvalidRendersTypeArgument -> "invalid-render" | InvalidSupportsPlatformDecl -> "invalid-supports-platform" diff --git a/src/common/reason.ml b/src/common/reason.ml index 0def553ce4c..ab8f1ea87c8 100644 --- a/src/common/reason.ml +++ b/src/common/reason.ml @@ -218,7 +218,6 @@ type 'loc virtual_reason_desc = | RReactChildrenOrType of 'loc virtual_reason_desc | RReactChildrenOrUndefinedOrType of 'loc virtual_reason_desc | RReactRef - | RReactConfig | RPossiblyMissingPropFromObj of name * 'loc virtual_reason_desc | RUnionBranching of 'loc virtual_reason_desc * int | RUninitialized @@ -313,8 +312,7 @@ let rec map_desc_locs f = function | RMatchingProp (s, desc) -> RMatchingProp (s, map_desc_locs f desc) | RImplicitThis desc -> RImplicitThis (map_desc_locs f desc) | ( RObjectPatternRestProp | RArrayPatternRestProp | RModule _ | RNamespace _ | ROptionalChain - | RReactProps | RReactElement _ | RReactDefaultProps | RReactChildren | RReactRef | RReactConfig - ) as r -> + | RReactProps | RReactElement _ | RReactDefaultProps | RReactChildren | RReactRef ) as r -> r | RReactChildrenOrType desc -> RReactChildrenOrType (map_desc_locs f desc) | RReactChildrenOrUndefinedOrType desc -> RReactChildrenOrUndefinedOrType (map_desc_locs f desc) @@ -719,7 +717,6 @@ let rec string_of_desc = function | RReactChildrenOrType desc -> spf "children array or %s" (string_of_desc desc) | RReactChildrenOrUndefinedOrType desc -> spf "children array or %s" (string_of_desc desc) | RReactRef -> "React component ref" - | RReactConfig -> "config of React component" | RPossiblyMissingPropFromObj (propname, desc) -> spf "possibly missing property `%s` in %s" @@ -1441,7 +1438,6 @@ let classification_of_reason_desc desc = | RReactChildrenOrType _ | RReactChildrenOrUndefinedOrType _ | RReactRef - | RReactConfig | RPossiblyMissingPropFromObj _ | RUnionBranching _ | REnum _ diff --git a/src/common/reason.mli b/src/common/reason.mli index 00639562d03..e3a9dadef31 100644 --- a/src/common/reason.mli +++ b/src/common/reason.mli @@ -178,7 +178,6 @@ type 'loc virtual_reason_desc = | RReactChildrenOrType of 'loc virtual_reason_desc | RReactChildrenOrUndefinedOrType of 'loc virtual_reason_desc | RReactRef - | RReactConfig | RPossiblyMissingPropFromObj of name * 'loc virtual_reason_desc | RUnionBranching of 'loc virtual_reason_desc * int | RUninitialized diff --git a/src/common/ty/ty.ml b/src/common/ty/ty.ml index b771a06e22c..0eef0b2fac3 100644 --- a/src/common/ty/ty.ml +++ b/src/common/ty/ty.ml @@ -293,7 +293,6 @@ and utility = (* React utils *) | ReactElementPropsType of t | ReactElementConfigType of t - | ReactConfigType of t * t and component_props = | UnflattenedComponentProps of t @@ -697,7 +696,6 @@ class ['A] comparator_ty = | Class _ -> 13 | ReactElementPropsType _ -> 18 | ReactElementConfigType _ -> 19 - | ReactConfigType _ -> 21 | ObjKeyMirror _ -> 22 | Partial _ -> 23 | Required _ -> 24 @@ -867,7 +865,6 @@ let string_of_utility_ctor = function | StringSuffix _ -> "StringSuffix" | ReactElementPropsType _ -> "React$ElementProps" | ReactElementConfigType _ -> "React$ElementConfig" - | ReactConfigType _ -> "React$Config" let types_of_utility = function | Keys t -> Some [t] @@ -892,7 +889,6 @@ let types_of_utility = function Some [StrLit (Reason.OrdinaryName arg); t] | ReactElementPropsType t -> Some [t] | ReactElementConfigType t -> Some [t] - | ReactConfigType (t1, t2) -> Some [t1; t2] let string_of_prop_source = function | Interface -> "interface" diff --git a/src/parser_utils/type_sig/type_sig.ml b/src/parser_utils/type_sig/type_sig.ml index 79c6e15e9f9..41851efe810 100644 --- a/src/parser_utils/type_sig/type_sig.ml +++ b/src/parser_utils/type_sig/type_sig.ml @@ -560,11 +560,6 @@ type ('loc, 'a) annot = loc: 'loc; config: 'a; } - | ReactConfig of { - loc: 'loc; - props: 'a; - default: 'a; - } | ReactCreateClass of 'loc | ReactElementProps of 'loc * 'a | ReactElementConfig of 'loc * 'a diff --git a/src/parser_utils/type_sig/type_sig_parse.ml b/src/parser_utils/type_sig/type_sig_parse.ml index 1d651c99434..aa53266b1f8 100644 --- a/src/parser_utils/type_sig/type_sig_parse.ml +++ b/src/parser_utils/type_sig/type_sig_parse.ml @@ -2406,14 +2406,6 @@ and maybe_special_unqualified_generic opts scope tbls xs loc targs ref_loc = | _ -> Err (loc, CheckError)) | _ -> Err (loc, CheckError) end - | "React$Config" -> begin - match targs with - | Some (_, { arguments = [props; default]; _ }) -> - let props = annot opts scope tbls xs props in - let default = annot opts scope tbls xs default in - Annot (ReactConfig { loc; props; default }) - | _ -> Err (loc, CheckError) - end | "React$ElementProps" -> begin match targs with | Some (_, { arguments = [t]; _ }) -> diff --git a/src/typing/debug_js.ml b/src/typing/debug_js.ml index d5cfd4409c9..3f544aeb707 100644 --- a/src/typing/debug_js.ml +++ b/src/typing/debug_js.ml @@ -40,7 +40,6 @@ let string_of_destructor = function | TypeMap ObjectKeyMirror -> "ObjectKeyMirror" | ReactElementPropsType -> "ReactElementProps" | ReactElementConfigType -> "ReactElementConfig" - | ReactConfigType _ -> "ReactConfig" | MappedType _ -> "MappedType" let string_of_destruct_kind = function @@ -452,8 +451,6 @@ and dump_use_t_ (depth, tvars) cx t = | ConfigCheck { props; instance = _ } -> spf "ConfigCheck (%s)" (kid props) | GetProps tout -> spf "GetProps (%s)" (kid tout) | GetConfig tout -> spf "GetConfig (%s)" (kid tout) - | GetConfigType (default_props, tout) -> - spf "GetConfigType (%s, %s)" (kid default_props) (kid tout) | GetRef tout -> spf "GetRef (%s)" (kid tout) ) in @@ -1573,11 +1570,6 @@ let dump_error_message = "ENotAReactComponent { reason = %s; use_op = %s }" (dump_reason cx reason) (string_of_use_op use_op) - | EInvalidReactConfigType { reason; use_op } -> - spf - "EInvalidReactConfigType { reason = %s; use_op = %s }" - (dump_reason cx reason) - (string_of_use_op use_op) | EReactElementFunArity (reason, _, _) -> spf "EReactElementFunArity (%s)" (dump_reason cx reason) | EFunctionCallExtraArg (unused_reason, def_reason, param_count, use_op) -> diff --git a/src/typing/default_resolve.ml b/src/typing/default_resolve.ml index 23d22316411..999f935047e 100644 --- a/src/typing/default_resolve.ml +++ b/src/typing/default_resolve.ml @@ -65,7 +65,6 @@ let rec default_resolve_touts ~flow ?resolve_callee cx loc u = | ConfigCheck { props = tout; instance = _ } | GetProps tout | GetConfig tout - | GetConfigType (_, tout) | GetRef tout -> resolve tout in diff --git a/src/typing/errors/error_message.ml b/src/typing/errors/error_message.ml index 73acec6d8b3..881a5dcd3d6 100644 --- a/src/typing/errors/error_message.ml +++ b/src/typing/errors/error_message.ml @@ -312,10 +312,6 @@ and 'loc t' = reason: 'loc virtual_reason; use_op: 'loc virtual_use_op; } - | EInvalidReactConfigType of { - reason: 'loc virtual_reason; - use_op: 'loc virtual_use_op; - } | EInvalidReactCreateElement of { create_element_loc: 'loc; invalid_react: 'loc virtual_reason; @@ -991,8 +987,6 @@ let rec map_loc_of_error_message (f : 'a -> 'b) : 'a t' -> 'b t' = } | ENotAReactComponent { reason; use_op } -> ENotAReactComponent { reason = map_reason reason; use_op = map_use_op use_op } - | EInvalidReactConfigType { reason; use_op } -> - EInvalidReactConfigType { reason = map_reason reason; use_op = map_use_op use_op } | EInvalidReactCreateElement { create_element_loc; invalid_react } -> EInvalidReactCreateElement { create_element_loc = f create_element_loc; invalid_react = map_reason invalid_react } @@ -1519,8 +1513,6 @@ let util_use_op_of_msg nope util = function util use_op (fun use_op -> EEnumIncompatible { contents with use_op }) | ENotAReactComponent { reason; use_op } -> util use_op (fun use_op -> ENotAReactComponent { reason; use_op }) - | EInvalidReactConfigType { reason; use_op } -> - util use_op (fun use_op -> EInvalidReactConfigType { reason; use_op }) | EFunctionCallExtraArg (rl, ru, n, op) -> util op (fun op -> EFunctionCallExtraArg (rl, ru, n, op)) | EPrimitiveAsInterface { use_op; reason; interface_reason; kind } -> @@ -1918,7 +1910,6 @@ let loc_of_msg : 'loc t' -> 'loc option = function | EInexactMayOverwriteIndexer _ | EFunctionCallExtraArg _ | ENotAReactComponent _ - | EInvalidReactConfigType _ | EIncompatibleWithUseOp _ | EEnumIncompatible _ | EIncompatibleDefs _ @@ -2543,14 +2534,6 @@ let friendly_message_of_msg = function use_op; explanation = None; } - | EInvalidReactConfigType { reason; use_op } -> - UseOp - { - loc = loc_of_reason reason; - message = MessageCannotCalculateReactConfig reason; - use_op; - explanation = None; - } | EReactElementFunArity (_, fn_name, n) -> Normal (MessageCannotCallReactFunctionWithoutAtLeastNArgs { fn_name; n }) | EReactRefInRender { usage; kind = Argument; in_hook } -> @@ -3061,7 +3044,6 @@ let error_code_of_message err : error_code option = | EInvalidLHSInAssignment _ -> Some InvalidLhs | EInvalidObjectKit _ -> Some NotAnObject | EInvalidPrototype _ -> Some NotAnObject - | EInvalidReactConfigType _ -> Some InvalidReactConfig | EInvalidReactCreateElement _ -> Some InvalidReactCreateElement | EInvalidTypeArgs (_, _) -> Some InvalidTypeArg | EInvalidTypeof _ -> Some IllegalTypeof diff --git a/src/typing/errors/flow_intermediate_error.ml b/src/typing/errors/flow_intermediate_error.ml index 460216913c4..9ec85aad8e7 100644 --- a/src/typing/errors/flow_intermediate_error.ml +++ b/src/typing/errors/flow_intermediate_error.ml @@ -1476,7 +1476,6 @@ let to_printable_error : text "Cannot build a typed interface for this module. " :: text "You should annotate the exports of this module with types. " :: features - | MessageCannotCalculateReactConfig reason -> [ref reason; text " cannot calculate config"] | MessageCannotCallMaybeReactHook { callee_loc; hooks; non_hooks } -> let hook_blame = match hooks with diff --git a/src/typing/errors/flow_intermediate_error_types.ml b/src/typing/errors/flow_intermediate_error_types.ml index 19197fcaf64..6b978b300c7 100644 --- a/src/typing/errors/flow_intermediate_error_types.ml +++ b/src/typing/errors/flow_intermediate_error_types.ml @@ -355,7 +355,6 @@ type 'loc message = } | MessageCannotAssignToInvalidLHS | MessageCannotBuildTypedInterface of 'loc Signature_error.t - | MessageCannotCalculateReactConfig of 'loc virtual_reason | MessageCannotCallMaybeReactHook of { callee_loc: 'loc; hooks: 'loc list; diff --git a/src/typing/flow_js.ml b/src/typing/flow_js.ml index 8efc1ecb755..5f569aff879 100644 --- a/src/typing/flow_js.ml +++ b/src/typing/flow_js.ml @@ -6827,11 +6827,6 @@ struct rec_flow cx trace (t, ReactKitT (use_op, reason, React.GetProps (OpenT tout))) | ReactElementConfigType -> rec_flow cx trace (t, ReactKitT (use_op, reason, React.GetConfig (OpenT tout))) - | ReactConfigType default_props -> - rec_flow - cx - trace - (t, ReactKitT (use_op, reason, React.GetConfigType (default_props, OpenT tout))) | MappedType { property_type; mapped_type_flags; homomorphic; distributive_tparam_name } -> let (property_type, homomorphic) = substitute_mapped_type_distributive_tparams diff --git a/src/typing/implicit_instantiation.ml b/src/typing/implicit_instantiation.ml index d3f773959ec..0d5bc479d5f 100644 --- a/src/typing/implicit_instantiation.ml +++ b/src/typing/implicit_instantiation.ml @@ -261,8 +261,7 @@ module Make (Observer : OBSERVER) (Flow : Flow_common.S) : S = struct | ReactDRO _ | MakeHooklike | PartialType - | RequiredType - | ReactConfigType _ -> + | RequiredType -> merge_lower_or_upper_bounds r (OpenT tout) | ReactCheckComponentConfig pmap -> merge_lower_or_upper_bounds r (OpenT tout) diff --git a/src/typing/react_kit.ml b/src/typing/react_kit.ml index cc1e8fbcec8..8a415ee26db 100644 --- a/src/typing/react_kit.ml +++ b/src/typing/react_kit.ml @@ -51,7 +51,6 @@ module Kit (Flow : Flow_common.S) : REACT = struct | CreateElement _ | ConfigCheck _ -> Error_message.ENotAReactComponent { reason; use_op } - | GetConfigType _ -> Error_message.EInvalidReactConfigType { reason; use_op } in Flow_js_utils.add_output cx err @@ -858,27 +857,6 @@ module Kit (Flow : Flow_common.S) : REACT = struct rec_flow_t ~use_op:unknown_use cx trace (elem, tout) in let get_config = get_config cx trace l ~use_op ~reason_op u Polarity.Positive in - let get_config_with_props_and_defaults default_props tout = - Object.( - Object.Rest.( - let props = l in - let tool = Resolve Next in - let state = One default_props in - rec_flow - cx - trace - ( props, - ObjKitT - ( Op UnknownUse, - reason_op, - tool, - Rest (ReactConfigMerge Polarity.Neutral, state), - tout - ) - ) - ) - ) - in let get_instance tout = let component = l in match drop_generic component with @@ -940,6 +918,5 @@ module Kit (Flow : Flow_common.S) : REACT = struct | ConfigCheck { props = jsx_props; instance } -> config_check use_op ~instance ~jsx_props | GetProps tout -> props_to_tout tout | GetConfig tout -> get_config tout - | GetConfigType (default_props, tout) -> get_config_with_props_and_defaults default_props tout | GetRef tout -> get_instance tout end diff --git a/src/typing/ty_normalizer.ml b/src/typing/ty_normalizer.ml index 4b6ae10814b..3b0fb90a654 100644 --- a/src/typing/ty_normalizer.ml +++ b/src/typing/ty_normalizer.ml @@ -446,7 +446,6 @@ module Make (I : INPUT) : S = struct | TypeMap _ | ReactElementPropsType | ReactElementConfigType - | ReactConfigType _ | ReactCheckComponentConfig _ | ReactDRO _ | MakeHooklike @@ -485,8 +484,7 @@ module Make (I : INPUT) : S = struct | TypeMap _ | EnumType | ReactElementPropsType - | ReactElementConfigType - | ReactConfigType _ -> + | ReactElementConfigType -> false) ) | Env.EvaluateAll -> @@ -1756,9 +1754,6 @@ module Make (I : INPUT) : S = struct | T.ReactCheckComponentConfig pmap -> check_component ~env ty pmap | T.ReactElementPropsType -> return (Ty.Utility (Ty.ReactElementPropsType ty)) | T.ReactElementConfigType -> return (Ty.Utility (Ty.ReactElementConfigType ty)) - | T.ReactConfigType default_props -> - let%map default_props' = type__ ~env default_props in - Ty.Utility (Ty.ReactConfigType (ty, default_props')) | T.RestType ((T.Object.Rest.SpreadReversal | T.Object.Rest.ReactConfigMerge _), _) as d -> terr ~kind:BadEvalT ~msg:(Debug_js.string_of_destructor d) None | T.MappedType { property_type; mapped_type_flags; homomorphic; distributive_tparam_name } -> diff --git a/src/typing/type.ml b/src/typing/type.ml index eab7e43c9ee..4ca6e56b309 100644 --- a/src/typing/type.ml +++ b/src/typing/type.ml @@ -1600,7 +1600,6 @@ module rec TypeTerm : sig | TypeMap of type_map | ReactElementPropsType | ReactElementConfigType - | ReactConfigType of t | ReactCheckComponentConfig of Property.t NameUtils.Map.t | ReactDRO of react_dro | MakeHooklike @@ -3058,7 +3057,6 @@ and React : sig } | GetProps of TypeTerm.t_out | GetConfig of TypeTerm.t_out - | GetConfigType of TypeTerm.t * TypeTerm.t_out | GetRef of TypeTerm.t_out end = React diff --git a/src/typing/type_annotation.ml b/src/typing/type_annotation.ml index 3afc632f6ea..a3d5573b246 100644 --- a/src/typing/type_annotation.ml +++ b/src/typing/type_annotation.ml @@ -1189,32 +1189,6 @@ module Make (Statement : Statement_sig.S) : Type_annotation_sig.S = struct ) ) targs) - | "React$Config" -> - if not (Context.is_lib_file cx) then - Flow_js_utils.add_output - cx - (Error_message.EInternalType - ( loc, - Flow_intermediate_error_types.ReactDollarUtilityTypesWithNonDollarAliases - "Config" - ) - ); - check_type_arg_arity cx loc t_ast targs 2 (fun () -> - let (ts, targs) = convert_type_params () in - let props = List.nth ts 0 in - let default_props = List.nth ts 1 in - let reason = mk_reason RReactConfig loc in - reconstruct_ast - (mk_type_destructor - cx - (use_op reason) - reason - props - (ReactConfigType default_props) - (mk_eval_id cx loc) - ) - targs - ) | "React$ElementProps" -> if not (Context.is_lib_file cx) then Flow_js_utils.add_output diff --git a/src/typing/type_mapper.ml b/src/typing/type_mapper.ml index 628c659adcd..7043dbf9e4c 100644 --- a/src/typing/type_mapper.ml +++ b/src/typing/type_mapper.ml @@ -668,12 +668,6 @@ class virtual ['a] t = false_t = false_t'; } | TypeMap ObjectKeyMirror -> t - | ReactConfigType default_props -> - let default_props' = self#type_ cx map_cx default_props in - if default_props' == default_props then - t - else - ReactConfigType default_props' | MappedType { property_type; mapped_type_flags; homomorphic; distributive_tparam_name } -> let property_type' = self#type_ cx map_cx property_type in let homomorphic' = diff --git a/src/typing/type_sig_merge.ml b/src/typing/type_sig_merge.ml index 58149cac050..ec60b5668fe 100644 --- a/src/typing/type_sig_merge.ml +++ b/src/typing/type_sig_merge.ml @@ -896,13 +896,6 @@ and merge_annot env file = function DefT (reason, ReactAbstractComponentT { config; instance; renders; component_kind = Structural }) ) - | ReactConfig { loc; props; default } -> - let reason = Reason.(mk_reason RReactConfig loc) in - let use_op = Type.Op (Type.TypeApplication { type_ = reason }) in - let props = merge env file props in - let default = merge env file default in - let id = eval_id_of_aloc file loc in - Type.(EvalT (props, TypeDestructorT (use_op, reason, ReactConfigType default), id)) | ReactCreateClass loc -> Type.AnyT.at Type.Untyped loc | ReactElementProps (loc, t) -> let reason = Reason.(mk_reason (RType (OrdinaryName "React$ElementProps")) loc) in diff --git a/src/typing/type_visitor.ml b/src/typing/type_visitor.ml index 879dbe6d550..c17f3280d25 100644 --- a/src/typing/type_visitor.ml +++ b/src/typing/type_visitor.ml @@ -218,7 +218,6 @@ class ['a] t = | ReactElementConfigType -> acc | ReactCheckComponentConfig map -> self#namemap (self#prop cx pole_TODO) acc map - | ReactConfigType default_props -> self#type_ cx pole_TODO acc default_props | ElementType { index_type; _ } -> self#type_ cx pole_TODO acc index_type | OptionalIndexedAccessNonMaybeType { index = OptionalIndexedAccessTypeIndex index_type } -> self#type_ cx pole_TODO acc index_type diff --git a/tests/autocomplete_react/autocomplete_react.exp b/tests/autocomplete_react/autocomplete_react.exp index 54dcd26d2a7..3f366230c83 100644 --- a/tests/autocomplete_react/autocomplete_react.exp +++ b/tests/autocomplete_react/autocomplete_react.exp @@ -436,10 +436,6 @@ Flags: --pretty "name":"ComponentType", "type":"type ComponentType<-P> = React$ComponentType

" }, - { - "name":"Config", - "type":"type Config = React$Config" - }, {"name":"Context","type":"type Context = React$Context"}, { "name":"ElementConfig", diff --git a/tests/badly_positioned_react/badly_positioned_react.exp b/tests/badly_positioned_react/badly_positioned_react.exp index 92bed591f68..3ce62272c21 100644 --- a/tests/badly_positioned_react/badly_positioned_react.exp +++ b/tests/badly_positioned_react/badly_positioned_react.exp @@ -14,8 +14,8 @@ References: test.js:21:29 21| const Foo1 = create(create1<{||}>(Foo)); ^^^^ [2] - /react.js:350:38 - 350| declare export type ComponentType<-P> = React$ComponentType

; + /react.js:349:38 + 349| declare export type ComponentType<-P> = React$ComponentType

; ^ [3] diff --git a/tests/component_syntax_unsupported/component_syntax_unsupported.exp b/tests/component_syntax_unsupported/component_syntax_unsupported.exp index b481d46fc43..9fb3e4215c2 100644 --- a/tests/component_syntax_unsupported/component_syntax_unsupported.exp +++ b/tests/component_syntax_unsupported/component_syntax_unsupported.exp @@ -17,11 +17,11 @@ Cannot cast `3` to `React.FragmentType` because number [1] is incompatible with ^ [1] References: - /react.js:760:5 + /react.js:748:5 v------------------------------------------------------ - 760| declare component Fragment( - 761| children?: Renders, - 762| ) renders Renders; + 748| declare component Fragment( + 749| children?: Renders, + 750| ) renders Renders; -----------------^ [2] diff --git a/tests/component_type/component_type.exp b/tests/component_type/component_type.exp index 849b8b08fa5..1187df0c7f8 100644 --- a/tests/component_type/component_type.exp +++ b/tests/component_type/component_type.exp @@ -322,8 +322,8 @@ References: component_to_component.js:26:37 26| x: component(ref: React.RefSetter, ...{...}), ^^^^^^^^^ [2] - /react.js:366:34 - 366| declare export type RefSetter<-T> = React$RefSetter; + /react.js:365:34 + 365| declare export type RefSetter<-T> = React$RefSetter; ^ [3] @@ -427,8 +427,8 @@ Cannot create `C` element because in property `ref`: [incompatible-type] ^^^^^^ References: - /react.js:710:8 - 710| ): React$RefObject; + /react.js:698:8 + 698| ): React$RefObject; ^^^^^^^^^^^^^^^^^^^^^^^^^ [1] /react.js:197:6 197| | ((T | null) => mixed) diff --git a/tests/internal_type_lint/internal_type_lint.exp b/tests/internal_type_lint/internal_type_lint.exp index 325e4f4bd28..f6418f9270c 100644 --- a/tests/internal_type_lint/internal_type_lint.exp +++ b/tests/internal_type_lint/internal_type_lint.exp @@ -16,44 +16,36 @@ Error -------------------------------------------------------------------------- Error ---------------------------------------------------------------------------------------------------- test.js:10:15 -`React$Config` is an internal Flow type. Use `React.Config` instead. [internal-type] - - 10| type T3_bad = React$Config<{}, {}>; // error - ^^^^^^^^^^^^^^^^^^^^ - - -Error ---------------------------------------------------------------------------------------------------- test.js:12:15 - `React$ElementRef` is an internal Flow type. Use `React.ElementRef` instead. [internal-type] - 12| type T4_bad = React$ElementRef; // error + 10| type T3_bad = React$ElementRef; // error ^^^^^^^^^^^^^^^^^^^ -Error ---------------------------------------------------------------------------------------------------- test.js:14:15 +Error ---------------------------------------------------------------------------------------------------- test.js:12:15 `React$ElementConfig` is an internal Flow type. Use `React.ElementConfig` instead. [internal-type] - 14| type T5_bad = React$ElementConfig; // error + 12| type T4_bad = React$ElementConfig; // error ^^^^^^^^^^^^^^^^^^^^^^ -Error ---------------------------------------------------------------------------------------------------- test.js:16:15 +Error ---------------------------------------------------------------------------------------------------- test.js:14:15 `React$ElementProps` is an internal Flow type. Use `React.ElementProps` instead. [internal-type] - 16| type T6_bad = React$ElementProps; // error + 14| type T5_bad = React$ElementProps; // error ^^^^^^^^^^^^^^^^^^^^^ -Error ---------------------------------------------------------------------------------------------------- test.js:18:15 +Error ---------------------------------------------------------------------------------------------------- test.js:16:15 `$ReactDeepReadOnly` is a secret internal Flow type exposed for testing purposes. There will be no stability guarantees. [internal-type] - 18| type T7_bad = $ReactDeepReadOnly<{}>; // error + 16| type T6_bad = $ReactDeepReadOnly<{}>; // error ^^^^^^^^^^^^^^^^^^^^^^ -Found 7 errors +Found 6 errors diff --git a/tests/internal_type_lint/test.js b/tests/internal_type_lint/test.js index ec2233dc2f6..52e0f062e9b 100644 --- a/tests/internal_type_lint/test.js +++ b/tests/internal_type_lint/test.js @@ -7,12 +7,10 @@ type T2_good = Enum; // ok type C = component(); -type T3_bad = React$Config<{}, {}>; // error -type T3_good = React.Config<{}, {}>; // ok -type T4_bad = React$ElementRef; // error -type T4_good = React.ElementRef; // ok -type T5_bad = React$ElementConfig; // error -type T5_good = React.ElementConfig; // ok -type T6_bad = React$ElementProps; // error -type T6_good = React.ElementProps; // ok -type T7_bad = $ReactDeepReadOnly<{}>; // error +type T3_bad = React$ElementRef; // error +type T3_good = React.ElementRef; // ok +type T4_bad = React$ElementConfig; // error +type T4_good = React.ElementConfig; // ok +type T5_bad = React$ElementProps; // error +type T5_good = React.ElementProps; // ok +type T6_bad = $ReactDeepReadOnly<{}>; // error diff --git a/tests/new_generics/new_generics.exp b/tests/new_generics/new_generics.exp index c44f3586584..62c1d88e880 100644 --- a/tests/new_generics/new_generics.exp +++ b/tests/new_generics/new_generics.exp @@ -1031,8 +1031,8 @@ References: react.js:13:28 13| a as React.ComponentType<{a: number}>; // nope, contravariance ^^^^^^^^^^^ [2] - /react.js:350:38 - 350| declare export type ComponentType<-P> = React$ComponentType

; + /react.js:349:38 + 349| declare export type ComponentType<-P> = React$ComponentType

; ^ [3] diff --git a/tests/react/react.exp b/tests/react/react.exp index 340d55b8c97..9b21dc78ff7 100644 --- a/tests/react/react.exp +++ b/tests/react/react.exp @@ -9,8 +9,8 @@ Cannot cast `x` to `React.RefSetter` because in type argument `T` [1]: [incompat ^ References: - /react.js:366:34 - 366| declare export type RefSetter<-T> = React$RefSetter; + /react.js:365:34 + 365| declare export type RefSetter<-T> = React$RefSetter; ^ [1] contravariant_refsetter.js:11:39 11| (x: React.RefSetter); // ERROR @@ -1547,8 +1547,8 @@ References: useCallback_hook.js:4:3 4| React.useCallback(); // Error: function requires another argument. ^^^^^^^^^^^^^^^^^^^ [1] - /react.js:903:33 - 903| declare hook useCallback) => mixed>( + /react.js:891:33 + 891| declare hook useCallback) => mixed>( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2] @@ -1627,8 +1627,8 @@ Cannot call `React.useMutationEffect` because property `useMutationEffect` is mi ^^^^^^^^^^^^^^^^^ References: - /react.js:1064:26 - 1064| declare export default typeof React; + /react.js:1041:26 + 1041| declare export default typeof React; ^^^^^^^^^^^^ [1] @@ -1692,8 +1692,8 @@ Cannot call `React.useContext` because no more than 1 argument is expected by fu ^^^^^ References: - /react.js:828:28 - 828| declare hook useContext(context: React$Context): T; + /react.js:816:28 + 816| declare hook useContext(context: React$Context): T; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] @@ -1706,8 +1706,8 @@ Cannot call `React.useContext` because no more than 1 argument is expected by fu ^^^^^ References: - /react.js:828:28 - 828| declare hook useContext(context: React$Context): T; + /react.js:816:28 + 816| declare hook useContext(context: React$Context): T; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] @@ -1737,8 +1737,8 @@ Cannot call `React.useDebugValue` because property `useDebugValue` is missing in ^^^^^^^^^^^^^ References: - /react.js:1064:26 - 1064| declare export default typeof React; + /react.js:1041:26 + 1041| declare export default typeof React; ^^^^^^^^^^^^ [1] @@ -1751,12 +1751,12 @@ Cannot call `React.useEffect` because function [1] requires another argument. [i ^^^^^^^^^ References: - /react.js:879:27 + /react.js:867:27 v - 879| declare hook useEffect( - 880| create: () => MaybeCleanUpFn, - 881| inputs?: ?$ReadOnlyArray, - 882| ): void; + 867| declare hook useEffect( + 868| create: () => MaybeCleanUpFn, + 869| inputs?: ?$ReadOnlyArray, + 870| ): void; ------^ [1] @@ -1770,8 +1770,8 @@ Cannot call `React.useEffect` with `1` bound to `create` because number [1] is i ^ [1] References: - /react.js:880:15 - 880| create: () => MaybeCleanUpFn, + /react.js:868:15 + 868| create: () => MaybeCleanUpFn, ^^^^^^^^^^^^^^^^^^^^ [2] @@ -1785,8 +1785,8 @@ type [2]. [incompatible-call] ^ [1] References: - /react.js:881:17 - 881| inputs?: ?$ReadOnlyArray, + /react.js:869:17 + 869| inputs?: ?$ReadOnlyArray, ^^^^^^^^^^^^^^^^^^^^^ [2] @@ -1802,11 +1802,11 @@ Cannot call `React.useEffect` with async function bound to `create` because in t ^ [1] References: - /react.js:445:41 - 445| declare type MaybeCleanUpFn = void | (() => void); + /react.js:433:41 + 433| declare type MaybeCleanUpFn = void | (() => void); ^^^^^^^^^^ [2] - /react.js:445:33 - 445| declare type MaybeCleanUpFn = void | (() => void); + /react.js:433:33 + 433| declare type MaybeCleanUpFn = void | (() => void); ^^^^ [3] @@ -1824,11 +1824,11 @@ References: useEffect_hook.js:23:31 23| React.useEffect(() => () => 123) // Error: cleanup function should not return a value ^^^ [1] - /react.js:445:47 - 445| declare type MaybeCleanUpFn = void | (() => void); + /react.js:433:47 + 433| declare type MaybeCleanUpFn = void | (() => void); ^^^^ [2] - /react.js:445:33 - 445| declare type MaybeCleanUpFn = void | (() => void); + /react.js:433:33 + 433| declare type MaybeCleanUpFn = void | (() => void); ^^^^ [4] @@ -1841,13 +1841,13 @@ Cannot call `React.useImperativeHandle` because function [1] requires another ar ^^^^^^^^^^^^^^^^^^^ References: - /react.js:925:37 + /react.js:913:37 v--- - 925| declare hook useImperativeHandle( - 926| ref: React$RefSetter | null | void, - 927| create: () => T, - 928| inputs: ?$ReadOnlyArray, - 929| ): void; + 913| declare hook useImperativeHandle( + 914| ref: React$RefSetter | null | void, + 915| create: () => T, + 916| inputs: ?$ReadOnlyArray, + 917| ): void; ------^ [1] @@ -1911,12 +1911,12 @@ Cannot call `React.useLayoutEffect` because function [1] requires another argume ^^^^^^^^^^^^^^^ References: - /react.js:892:33 + /react.js:880:33 v - 892| declare hook useLayoutEffect( - 893| create: () => MaybeCleanUpFn, - 894| inputs?: ?$ReadOnlyArray, - 895| ): void; + 880| declare hook useLayoutEffect( + 881| create: () => MaybeCleanUpFn, + 882| inputs?: ?$ReadOnlyArray, + 883| ): void; ------^ [1] @@ -1930,8 +1930,8 @@ type [2]. [incompatible-call] ^ [1] References: - /react.js:893:15 - 893| create: () => MaybeCleanUpFn, + /react.js:881:15 + 881| create: () => MaybeCleanUpFn, ^^^^^^^^^^^^^^^^^^^^ [2] @@ -1945,8 +1945,8 @@ type [2]. [incompatible-call] ^ [1] References: - /react.js:894:17 - 894| inputs?: ?$ReadOnlyArray, + /react.js:882:17 + 882| inputs?: ?$ReadOnlyArray, ^^^^^^^^^^^^^^^^^^^^^ [2] @@ -1963,11 +1963,11 @@ Cannot call `React.useLayoutEffect` with async function bound to `create` becaus ^ [1] References: - /react.js:445:41 - 445| declare type MaybeCleanUpFn = void | (() => void); + /react.js:433:41 + 433| declare type MaybeCleanUpFn = void | (() => void); ^^^^^^^^^^ [2] - /react.js:445:33 - 445| declare type MaybeCleanUpFn = void | (() => void); + /react.js:433:33 + 433| declare type MaybeCleanUpFn = void | (() => void); ^^^^ [3] @@ -1985,11 +1985,11 @@ References: useLayoutEffect_hook.js:23:37 23| React.useLayoutEffect(() => () => 123) // Error: cleanup function should not return a value ^^^ [1] - /react.js:445:47 - 445| declare type MaybeCleanUpFn = void | (() => void); + /react.js:433:47 + 433| declare type MaybeCleanUpFn = void | (() => void); ^^^^ [2] - /react.js:445:33 - 445| declare type MaybeCleanUpFn = void | (() => void); + /react.js:433:33 + 433| declare type MaybeCleanUpFn = void | (() => void); ^^^^ [4] @@ -2002,12 +2002,12 @@ Cannot call `React.useMemo` because function [1] requires another argument. [inc ^^^^^^^ References: - /react.js:914:25 + /react.js:902:25 v--- - 914| declare hook useMemo( - 915| create: () => T, - 916| inputs: ?$ReadOnlyArray, - 917| ): T; + 902| declare hook useMemo( + 903| create: () => T, + 904| inputs: ?$ReadOnlyArray, + 905| ): T; ---^ [1] @@ -2038,8 +2038,8 @@ Cannot call `React.useMutationEffect` because property `useMutationEffect` is mi ^^^^^^^^^^^^^^^^^ References: - /react.js:1064:26 - 1064| declare export default typeof React; + /react.js:1041:26 + 1041| declare export default typeof React; ^^^^^^^^^^^^ [1] @@ -2053,8 +2053,8 @@ Cannot call `React.useMutationEffect` because property `useMutationEffect` is mi ^^^^^^^^^^^^^^^^^ References: - /react.js:1064:26 - 1064| declare export default typeof React; + /react.js:1041:26 + 1041| declare export default typeof React; ^^^^^^^^^^^^ [1] @@ -2068,8 +2068,8 @@ Cannot call `React.useMutationEffect` because property `useMutationEffect` is mi ^^^^^^^^^^^^^^^^^ References: - /react.js:1064:26 - 1064| declare export default typeof React; + /react.js:1041:26 + 1041| declare export default typeof React; ^^^^^^^^^^^^ [1] @@ -2083,8 +2083,8 @@ Cannot call `React.useMutationEffect` because property `useMutationEffect` is mi ^^^^^^^^^^^^^^^^^ References: - /react.js:1064:26 - 1064| declare export default typeof React; + /react.js:1041:26 + 1041| declare export default typeof React; ^^^^^^^^^^^^ [1] @@ -2098,8 +2098,8 @@ Cannot call `React.useMutationEffect` because property `useMutationEffect` is mi ^^^^^^^^^^^^^^^^^ References: - /react.js:1064:26 - 1064| declare export default typeof React; + /react.js:1041:26 + 1041| declare export default typeof React; ^^^^^^^^^^^^ [1] @@ -2113,8 +2113,8 @@ Cannot call `React.useMutationEffect` because property `useMutationEffect` is mi ^^^^^^^^^^^^^^^^^ References: - /react.js:1064:26 - 1064| declare export default typeof React; + /react.js:1041:26 + 1041| declare export default typeof React; ^^^^^^^^^^^^ [1] @@ -2128,8 +2128,8 @@ Cannot call `React.useMutationEffect` because property `useMutationEffect` is mi ^^^^^^^^^^^^^^^^^ References: - /react.js:1064:26 - 1064| declare export default typeof React; + /react.js:1041:26 + 1041| declare export default typeof React; ^^^^^^^^^^^^ [1] @@ -2143,8 +2143,8 @@ Cannot call `React.useMutationEffect` because property `useMutationEffect` is mi ^^^^^^^^^^^^^^^^^ References: - /react.js:1064:26 - 1064| declare export default typeof React; + /react.js:1041:26 + 1041| declare export default typeof React; ^^^^^^^^^^^^ [1] @@ -2158,8 +2158,8 @@ Cannot call `React.useMutationEffect` because property `useMutationEffect` is mi ^^^^^^^^^^^^^^^^^ References: - /react.js:1064:26 - 1064| declare export default typeof React; + /react.js:1041:26 + 1041| declare export default typeof React; ^^^^^^^^^^^^ [1] @@ -2175,31 +2175,31 @@ Cannot call `React.useReducer` because: [incompatible-call] ^^^^^^^^^^ References: - /react.js:848:28 + /react.js:836:28 v------ - 848| declare hook useReducer( - 849| reducer: (S, A) => S, - 850| initialState: S, - 851| ): [S, Dispatch]; + 836| declare hook useReducer( + 837| reducer: (S, A) => S, + 838| initialState: S, + 839| ): [S, Dispatch]; ------------------^ [1] useReducer_hook.js:4:3 4| React.useReducer(); // Error: function requires another argument. ^^^^^^^^^^^^^^^^^^ [2] - /react.js:853:28 + /react.js:841:28 v------ - 853| declare hook useReducer( - 854| reducer: (S, A) => S, - 855| initialState: S, - 856| init: void, - 857| ): [S, Dispatch]; + 841| declare hook useReducer( + 842| reducer: (S, A) => S, + 843| initialState: S, + 844| init: void, + 845| ): [S, Dispatch]; ------------------^ [3] - /react.js:859:28 + /react.js:847:28 v--------- - 859| declare hook useReducer( - 860| reducer: (S, A) => S, - 861| initialArg: I, - 862| init: (I) => S, - 863| ): [S, Dispatch]; + 847| declare hook useReducer( + 848| reducer: (S, A) => S, + 849| initialArg: I, + 850| init: (I) => S, + 851| ): [S, Dispatch]; ------------------^ [4] @@ -2410,8 +2410,8 @@ References: useState_hook.js:5:42 5| const [count, setCount] = React.useState(1); ^^^^^^ [2] - /react.js:1056:39 - 1056| type ReactSetStateFunction = ((S => S) | S) => void; + /react.js:1033:39 + 1033| type ReactSetStateFunction = ((S => S) | S) => void; ^^^^^^ [3] @@ -2480,11 +2480,11 @@ Cannot call `use` with `null` bound to `usable` because: [incompatible-call] ^^^^ [1] References: - /react.js:408:28 - 408| declare type Usable = Thenable | React$Context; + /react.js:396:28 + 396| declare type Usable = Thenable | React$Context; ^^^^^^^^^^^ [2] - /react.js:408:42 - 408| declare type Usable = Thenable | React$Context; + /react.js:396:42 + 396| declare type Usable = Thenable | React$Context; ^^^^^^^^^^^^^^^^ [3] @@ -2499,11 +2499,11 @@ Cannot call `use` with `undefined` bound to `usable` because: [incompatible-call ^^^^^^^^^ [1] References: - /react.js:408:28 - 408| declare type Usable = Thenable | React$Context; + /react.js:396:28 + 396| declare type Usable = Thenable | React$Context; ^^^^^^^^^^^ [2] - /react.js:408:42 - 408| declare type Usable = Thenable | React$Context; + /react.js:396:42 + 396| declare type Usable = Thenable | React$Context; ^^^^^^^^^^^^^^^^ [3] @@ -2519,11 +2519,11 @@ Cannot call `use` with `0` bound to `usable` because: [incompatible-call] ^ [1] References: - /react.js:408:28 - 408| declare type Usable = Thenable | React$Context; + /react.js:396:28 + 396| declare type Usable = Thenable | React$Context; ^^^^^^^^^^^ [2] - /react.js:408:42 - 408| declare type Usable = Thenable | React$Context; + /react.js:396:42 + 396| declare type Usable = Thenable | React$Context; ^^^^^^^^^^^^^^^^ [3] @@ -2538,11 +2538,11 @@ Cannot call `use` with object literal bound to `usable` because: [incompatible-c ^^ [1] References: - /react.js:408:28 - 408| declare type Usable = Thenable | React$Context; + /react.js:396:28 + 396| declare type Usable = Thenable | React$Context; ^^^^^^^^^^^ [2] - /react.js:408:42 - 408| declare type Usable = Thenable | React$Context; + /react.js:396:42 + 396| declare type Usable = Thenable | React$Context; ^^^^^^^^^^^^^^^^ [3] diff --git a/tests/react_16_3/react_16_3.exp b/tests/react_16_3/react_16_3.exp index 80631e51ee1..8946937be6e 100644 --- a/tests/react_16_3/react_16_3.exp +++ b/tests/react_16_3/react_16_3.exp @@ -46,8 +46,8 @@ Cannot create `FancyButton` element because in property `ref`: [incompatible-typ ^^^^^^ References: - /react.js:710:8 - 710| ): React$RefObject; + /react.js:698:8 + 698| ): React$RefObject; ^^^^^^^^^^^^^^^^^^^^^^^^^ [1] /react.js:197:6 197| | ((T | null) => mixed) @@ -91,8 +91,8 @@ Cannot create `UnionRef` element because in property `ref`: [incompatible-type] ^^^^^^^^^^^ References: - /react.js:710:8 - 710| ): React$RefObject; + /react.js:698:8 + 698| ): React$RefObject; ^^^^^^^^^^^^^^^^^^^^^^^^^ [1] /react.js:197:6 197| | ((T | null) => mixed) diff --git a/tests/react_16_6/react_16_6.exp b/tests/react_16_6/react_16_6.exp index 7fc465a7d48..a3b1bb1c150 100644 --- a/tests/react_16_6/react_16_6.exp +++ b/tests/react_16_6/react_16_6.exp @@ -37,17 +37,17 @@ References: lazy.js:6:1 6| function FunctionComponent(x: Props): React.Node { return null } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] - /react.js:665:24 + /react.js:653:24 v------- - 665| component: () => Promise< - 666| $ReadOnly<{ - 667| default: component( - 668| ref: React.RefSetter, - 669| ...Config - 670| ) renders Renders, - 671| ... - 672| }>, - 673| >, + 653| component: () => Promise< + 654| $ReadOnly<{ + 655| default: component( + 656| ref: React.RefSetter, + 657| ...Config + 658| ) renders Renders, + 659| ... + 660| }>, + 661| >, ^ [2] @@ -64,17 +64,17 @@ References: lazy.js:7:7 7| class ClassComponent extends React.Component {} ^^^^^^^^^^^^^^ [1] - /react.js:665:24 + /react.js:653:24 v------- - 665| component: () => Promise< - 666| $ReadOnly<{ - 667| default: component( - 668| ref: React.RefSetter, - 669| ...Config - 670| ) renders Renders, - 671| ... - 672| }>, - 673| >, + 653| component: () => Promise< + 654| $ReadOnly<{ + 655| default: component( + 656| ref: React.RefSetter, + 657| ...Config + 658| ) renders Renders, + 659| ... + 660| }>, + 661| >, ^ [2] @@ -91,15 +91,15 @@ References: lazy.js:6:1 6| function FunctionComponent(x: Props): React.Node { return null } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] - /react.js:666:19 + /react.js:654:19 v - 666| $ReadOnly<{ - 667| default: component( - 668| ref: React.RefSetter, - 669| ...Config - 670| ) renders Renders, - 671| ... - 672| }>, + 654| $ReadOnly<{ + 655| default: component( + 656| ref: React.RefSetter, + 657| ...Config + 658| ) renders Renders, + 659| ... + 660| }>, ^ [2] /core.js:2102:24 2102| declare class Promise<+R = mixed> { @@ -119,15 +119,15 @@ References: lazy.js:7:7 7| class ClassComponent extends React.Component {} ^^^^^^^^^^^^^^ [1] - /react.js:666:19 + /react.js:654:19 v - 666| $ReadOnly<{ - 667| default: component( - 668| ref: React.RefSetter, - 669| ...Config - 670| ) renders Renders, - 671| ... - 672| }>, + 654| $ReadOnly<{ + 655| default: component( + 656| ref: React.RefSetter, + 657| ...Config + 658| ) renders Renders, + 659| ... + 660| }>, ^ [2] /core.js:2102:24 2102| declare class Promise<+R = mixed> { @@ -364,8 +364,8 @@ Cannot call `React.forwardRef` with `Demo` bound to `render` because in the seco ^^^^ References: - /react.js:751:36 - 751| render: (props: Config, ref: React$RefSetter) => Renders, + /react.js:739:36 + 739| render: (props: Config, ref: React$RefSetter) => Renders, ^^^^^^^^^^^^^^^^^^^^^^^^^ [1] memo_ref.js:7:33 7| function Demo(props: {}, ref: ?({current: (T | null), ...} | ((inst: (T | null)) => mixed))) { diff --git a/tests/react_16_9/react_16_9.exp b/tests/react_16_9/react_16_9.exp index 7982d6dd860..989783e55ad 100644 --- a/tests/react_16_9/react_16_9.exp +++ b/tests/react_16_9/react_16_9.exp @@ -8,8 +8,8 @@ Cannot get `React.ProfilerOnRenderFnType` because property `ProfilerOnRenderFnTy ^^^^^^^^^^^^^^^^^^^^^^ References: - /react.js:285:16 - 285| declare module react { + /react.js:284:16 + 284| declare module react { ^^^^^ [1] @@ -26,13 +26,13 @@ References: profiler.js:17:12 17| const _b = ; // Error, id and onRender are required ^^^^^^^^^^^^^^^^^^ [1] - /react.js:816:38 + /react.js:804:38 v - 816| declare const Profiler: component( - 817| children?: React$Node, - 818| id: string, - 819| onRender: ProfilerOnRenderFnType, - 820| ); + 804| declare const Profiler: component( + 805| children?: React$Node, + 806| id: string, + 807| onRender: ProfilerOnRenderFnType, + 808| ); ^ [2] @@ -49,13 +49,13 @@ References: profiler.js:17:12 17| const _b = ; // Error, id and onRender are required ^^^^^^^^^^^^^^^^^^ [1] - /react.js:816:38 + /react.js:804:38 v - 816| declare const Profiler: component( - 817| children?: React$Node, - 818| id: string, - 819| onRender: ProfilerOnRenderFnType, - 820| ); + 804| declare const Profiler: component( + 805| children?: React$Node, + 806| id: string, + 807| onRender: ProfilerOnRenderFnType, + 808| ); ^ [2] diff --git a/tests/react_children/react_children.exp b/tests/react_children/react_children.exp index 1d182a5c7a6..b94a4a4d70e 100644 --- a/tests/react_children/react_children.exp +++ b/tests/react_children/react_children.exp @@ -198,8 +198,8 @@ Cannot call `s` with `Children.count(...)` bound to `x` because number [1] is in ^^^^^^^^^^^^^^^^^ References: - /react.js:784:44 - 784| count(children: ChildrenArray): number, + /react.js:772:44 + 772| count(children: ChildrenArray): number, ^^^^^^ [1] api.js:32:15 32| function s(x: string) {} diff --git a/tests/react_clone_element/react_clone_element.exp b/tests/react_clone_element/react_clone_element.exp index 3136f49a222..020bb0714ba 100644 --- a/tests/react_clone_element/react_clone_element.exp +++ b/tests/react_clone_element/react_clone_element.exp @@ -11,41 +11,41 @@ Cannot call `React.cloneElement` because: [incompatible-call] ^^^^^^^^^^^^ References: - /react.js:263:6 + /react.js:262:6 v----------------------------------------------- - 263| & (, E: React$Element>( - 264| element: E, - 265| props?: ?Partial<$JSXIntrinsics[C]['props']>, - 266| ...children: $ReadOnlyArray - 267| ) => E) + 262| & (, E: React$Element>( + 263| element: E, + 264| props?: ?Partial<$JSXIntrinsics[C]['props']>, + 265| ...children: $ReadOnlyArray + 266| ) => E) -----^ [1] test.js:19:1 19| React.cloneElement(); // Error: Needs a minimum of two arguments. ^^^^^^^^^^^^^^^^^^^^ [2] - /react.js:268:6 + /react.js:267:6 v------------------------------------------------------------------ - 268| & (, E: React$Element>( - 269| element: E, - 270| props?: ?Partial<$ReadOnly<{|...$Exact>, key: React$Key, ref: React$RefSetter>>|}>>, - 271| ) => E) + 267| & (, E: React$Element>( + 268| element: E, + 269| props?: ?Partial<$ReadOnly<{|...$Exact>, key: React$Key, ref: React$RefSetter>>|}>>, + 270| ) => E) -----^ [3] - /react.js:272:6 + /react.js:271:6 v------------------------------------------------------------------ - 272| & (, E: React$Element>( - 273| element: E, - 274| props: ?Partial<$ReadOnly<{|...$Exact>, key: React$Key, ref: React$RefSetter>>|}>>, - 275| children: NoInfer['children'] - 276| ) => E) + 271| & (, E: React$Element>( + 272| element: E, + 273| props: ?Partial<$ReadOnly<{|...$Exact>, key: React$Key, ref: React$RefSetter>>|}>>, + 274| children: NoInfer['children'] + 275| ) => E) -----^ [4] - /react.js:277:6 + /react.js:276:6 v------------------------------------------------------------------ - 277| & (, E: React$Element>( - 278| element: E, - 279| props: ?Partial<$ReadOnly<{|...$Exact>, key: React$Key, ref: React$RefSetter>>|}>>, - 280| firstChild: NoInfer['children'][0], - 281| secondChild: NoInfer['children'][1], - 282| ...restChildren: NoInfer['children'] extends [+first: mixed, +second: mixed, ...infer Rest] ? Rest : NoInfer['children'] - 283| ) => E); + 276| & (, E: React$Element>( + 277| element: E, + 278| props: ?Partial<$ReadOnly<{|...$Exact>, key: React$Key, ref: React$RefSetter>>|}>>, + 279| firstChild: NoInfer['children'][0], + 280| secondChild: NoInfer['children'][1], + 281| ...restChildren: NoInfer['children'] extends [+first: mixed, +second: mixed, ...infer Rest] ? Rest : NoInfer['children'] + 282| ) => E); -----^ [5] @@ -65,17 +65,17 @@ References: test.js:20:20 20| React.cloneElement('nope'); // Error: Not a valid element type. ^^^^^^ [1] - /react.js:263:36 - 263| & (, E: React$Element>( + /react.js:262:36 + 262| & (, E: React$Element>( ^^^^^^^^^^^^^^^^ [2] - /react.js:268:48 - 268| & (, E: React$Element>( + /react.js:267:48 + 267| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^^^ [3] - /react.js:272:48 - 272| & (, E: React$Element>( + /react.js:271:48 + 271| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^^^ [4] - /react.js:277:48 - 277| & (, E: React$Element>( + /react.js:276:48 + 276| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^^^ [5] @@ -95,17 +95,17 @@ References: test.js:21:20 21| React.cloneElement({ type: any }); // Error: Not a valid element type. ^^^^^^^^^^^^^ [1] - /react.js:263:36 - 263| & (, E: React$Element>( + /react.js:262:36 + 262| & (, E: React$Element>( ^^^^^^^^^^^^^^^^ [2] - /react.js:268:48 - 268| & (, E: React$Element>( + /react.js:267:48 + 267| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^^^ [3] - /react.js:272:48 - 272| & (, E: React$Element>( + /react.js:271:48 + 271| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^^^ [4] - /react.js:277:48 - 277| & (, E: React$Element>( + /react.js:276:48 + 276| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^^^ [5] @@ -150,8 +150,8 @@ References: /react.js:150:36 150| declare opaque type React$Element<+ElementType: React$ElementType, +P = React$ElementProps>: {...}; ^^^^^^^^^^^ [3] - /react.js:270:32 - 270| props?: ?Partial<$ReadOnly<{|...$Exact>, key: React$Key, ref: React$RefSetter>>|}>>, + /react.js:269:32 + 269| props?: ?Partial<$ReadOnly<{|...$Exact>, key: React$Key, ref: React$RefSetter>>|}>>, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [4] test.js:31:23 31| React.cloneElement(a, {foo: 1, bar: 2}); // Error: `bar` is extra @@ -262,12 +262,12 @@ References: /react.js:150:36 150| declare opaque type React$Element<+ElementType: React$ElementType, +P = React$ElementProps>: {...}; ^^^^^^^^^^^ [3] - /react.js:268:6 + /react.js:267:6 v------------------------------------------------------------------ - 268| & (, E: React$Element>( - 269| element: E, - 270| props?: ?Partial<$ReadOnly<{|...$Exact>, key: React$Key, ref: React$RefSetter>>|}>>, - 271| ) => E) + 267| & (, E: React$Element>( + 268| element: E, + 269| props?: ?Partial<$ReadOnly<{|...$Exact>, key: React$Key, ref: React$RefSetter>>|}>>, + 270| ) => E) -----^ [4] @@ -285,18 +285,18 @@ References: test.js:15:45 15| declare var c: ExactReactElement_DEPRECATED>; ^^^^^^^^ [1] - /react.js:263:10 - 263| & (, E: React$Element>( + /react.js:262:10 + 262| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^ [2] /react.js:150:36 150| declare opaque type React$Element<+ElementType: React$ElementType, +P = React$ElementProps>: {...}; ^^^^^^^^^^^ [3] - /react.js:268:6 + /react.js:267:6 v------------------------------------------------------------------ - 268| & (, E: React$Element>( - 269| element: E, - 270| props?: ?Partial<$ReadOnly<{|...$Exact>, key: React$Key, ref: React$RefSetter>>|}>>, - 271| ) => E) + 267| & (, E: React$Element>( + 268| element: E, + 269| props?: ?Partial<$ReadOnly<{|...$Exact>, key: React$Key, ref: React$RefSetter>>|}>>, + 270| ) => E) -----^ [4] @@ -314,18 +314,18 @@ References: test.js:15:45 15| declare var c: ExactReactElement_DEPRECATED>; ^^^^^^^^ [1] - /react.js:263:10 - 263| & (, E: React$Element>( + /react.js:262:10 + 262| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^ [2] /react.js:150:36 150| declare opaque type React$Element<+ElementType: React$ElementType, +P = React$ElementProps>: {...}; ^^^^^^^^^^^ [3] - /react.js:268:6 + /react.js:267:6 v------------------------------------------------------------------ - 268| & (, E: React$Element>( - 269| element: E, - 270| props?: ?Partial<$ReadOnly<{|...$Exact>, key: React$Key, ref: React$RefSetter>>|}>>, - 271| ) => E) + 267| & (, E: React$Element>( + 268| element: E, + 269| props?: ?Partial<$ReadOnly<{|...$Exact>, key: React$Key, ref: React$RefSetter>>|}>>, + 270| ) => E) -----^ [4] @@ -399,8 +399,8 @@ References: test.js:16:45 16| declare var d: ExactReactElement_DEPRECATED>; ^^^^^^^^ [1] - /react.js:263:10 - 263| & (, E: React$Element>( + /react.js:262:10 + 262| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^ [2] /react.js:150:36 150| declare opaque type React$Element<+ElementType: React$ElementType, +P = React$ElementProps>: {...}; @@ -427,8 +427,8 @@ References: test.js:16:45 16| declare var d: ExactReactElement_DEPRECATED>; ^^^^^^^^ [1] - /react.js:263:10 - 263| & (, E: React$Element>( + /react.js:262:10 + 262| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^ [2] /react.js:150:36 150| declare opaque type React$Element<+ElementType: React$ElementType, +P = React$ElementProps>: {...}; @@ -489,8 +489,8 @@ References: /react.js:150:36 150| declare opaque type React$Element<+ElementType: React$ElementType, +P = React$ElementProps>: {...}; ^^^^^^^^^^^ [3] - /react.js:270:32 - 270| props?: ?Partial<$ReadOnly<{|...$Exact>, key: React$Key, ref: React$RefSetter>>|}>>, + /react.js:269:32 + 269| props?: ?Partial<$ReadOnly<{|...$Exact>, key: React$Key, ref: React$RefSetter>>|}>>, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [4] test.js:76:27 76| React.cloneElement(exact, {foo: 1, bar: 2}); // ERROR @@ -513,20 +513,20 @@ References: /react.js:181:49 181| declare type React$MixedElement = React$Element; ^^^^^^^^^^^^^^^^^ [1] - /react.js:263:10 - 263| & (, E: React$Element>( + /react.js:262:10 + 262| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^ [2] /react.js:150:36 150| declare opaque type React$Element<+ElementType: React$ElementType, +P = React$ElementProps>: {...}; ^^^^^^^^^^^ [3] - /react.js:268:17 - 268| & (, E: React$Element>( + /react.js:267:17 + 267| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^^^^^^ [4] - /react.js:272:17 - 272| & (, E: React$Element>( + /react.js:271:17 + 271| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^^^^^^ [5] - /react.js:277:17 - 277| & (, E: React$Element>( + /react.js:276:17 + 276| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^^^^^^ [6] @@ -552,14 +552,14 @@ References: /react.js:150:36 150| declare opaque type React$Element<+ElementType: React$ElementType, +P = React$ElementProps>: {...}; ^^^^^^^^^^^ [3] - /react.js:268:17 - 268| & (, E: React$Element>( + /react.js:267:17 + 267| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^^^^^^ [4] - /react.js:272:17 - 272| & (, E: React$Element>( + /react.js:271:17 + 271| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^^^^^^ [5] - /react.js:277:17 - 277| & (, E: React$Element>( + /react.js:276:17 + 276| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^^^^^^ [6] @@ -579,17 +579,17 @@ References: test.js:98:21 98| declare const el: React.Node; ^^^^^^^^^^ [1] - /react.js:263:36 - 263| & (, E: React$Element>( + /react.js:262:36 + 262| & (, E: React$Element>( ^^^^^^^^^^^^^^^^ [2] - /react.js:268:48 - 268| & (, E: React$Element>( + /react.js:267:48 + 267| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^^^ [3] - /react.js:272:48 - 272| & (, E: React$Element>( + /react.js:271:48 + 271| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^^^ [4] - /react.js:277:48 - 277| & (, E: React$Element>( + /react.js:276:48 + 276| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^^^ [5] @@ -609,17 +609,17 @@ References: test.js:98:21 98| declare const el: React.Node; ^^^^^^^^^^ [1] - /react.js:263:36 - 263| & (, E: React$Element>( + /react.js:262:36 + 262| & (, E: React$Element>( ^^^^^^^^^^^^^^^^ [2] - /react.js:268:48 - 268| & (, E: React$Element>( + /react.js:267:48 + 267| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^^^ [3] - /react.js:272:48 - 272| & (, E: React$Element>( + /react.js:271:48 + 271| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^^^ [4] - /react.js:277:48 - 277| & (, E: React$Element>( + /react.js:276:48 + 276| & (, E: React$Element>( ^^^^^^^^^^^^^^^^^^^^^^^ [5] diff --git a/tests/react_experimental/react_experimental.exp b/tests/react_experimental/react_experimental.exp index f49c34c0da7..f633345df13 100644 --- a/tests/react_experimental/react_experimental.exp +++ b/tests/react_experimental/react_experimental.exp @@ -7,8 +7,8 @@ Cannot call `React.startTransition` because function [1] requires another argume ^^^^^^^^^^^^^^^ References: - /react.js:952:37 - 952| declare function startTransition(() => void): void; + /react.js:940:37 + 940| declare function startTransition(() => void): void; ^^^^^^^^^^^^^^^^^^ [1] @@ -21,8 +21,8 @@ Cannot call `React.useDeferredValue` because no more than 1 argument is expected ^^ References: - /react.js:937:34 - 937| declare hook useDeferredValue(value: T): T; + /react.js:925:34 + 925| declare hook useDeferredValue(value: T): T; ^^^^^^^^^^^^^^^^ [1] @@ -35,8 +35,8 @@ Cannot call `React.useTransition` because no arguments are expected by function ^^ References: - /react.js:945:31 - 945| declare hook useTransition(): [boolean, (() => void) => void]; + /react.js:933:31 + 933| declare hook useTransition(): [boolean, (() => void) => void]; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] @@ -49,8 +49,8 @@ Cannot cast `isPending` to function type because boolean [1] is incompatible wit ^^^^^^^^^ References: - /react.js:945:36 - 945| declare hook useTransition(): [boolean, (() => void) => void]; + /react.js:933:36 + 933| declare hook useTransition(): [boolean, (() => void) => void]; ^^^^^^^ [1] useTransition_hook.js:12:13 12| (isPending: (() => void) => void); // Error: boolean is incompatible with function type @@ -66,8 +66,8 @@ Cannot cast `startTransition` to boolean because function type [1] is incompatib ^^^^^^^^^^^^^^^ References: - /react.js:945:45 - 945| declare hook useTransition(): [boolean, (() => void) => void]; + /react.js:933:45 + 933| declare hook useTransition(): [boolean, (() => void) => void]; ^^^^^^^^^^^^^^^^^^^^ [1] useTransition_hook.js:13:19 13| (startTransition: boolean); // Error: function type is incompatible with boolean @@ -83,8 +83,8 @@ Cannot call `startTransition` because function [1] requires another argument. [i ^^^^^^^^^^^^^^^ References: - /react.js:945:45 - 945| declare hook useTransition(): [boolean, (() => void) => void]; + /react.js:933:45 + 933| declare hook useTransition(): [boolean, (() => void) => void]; ^^^^^^^^^^^^^^^^^^^^ [1] diff --git a/tests/react_imports/react_imports.exp b/tests/react_imports/react_imports.exp index 0d68d4bd62b..936d5cf0625 100644 --- a/tests/react_imports/react_imports.exp +++ b/tests/react_imports/react_imports.exp @@ -103,8 +103,8 @@ Cannot get `React.Missing` because property `Missing` is missing in namespace Re ^^^^^^^ References: - /react.js:1064:26 - 1064| declare export default typeof React; + /react.js:1041:26 + 1041| declare export default typeof React; ^^^^^^^^^^^^ [1] @@ -158,8 +158,8 @@ Cannot get `React.Missing` because property `Missing` is missing in module `reac ^^^^^^^ References: - /react.js:285:16 - 285| declare module react { + /react.js:284:16 + 284| declare module react { ^^^^^ [1] diff --git a/tests/type_at_pos_jsx/type_at_pos_jsx.exp b/tests/type_at_pos_jsx/type_at_pos_jsx.exp index 17f663538b0..76a6dc41dbd 100644 --- a/tests/type_at_pos_jsx/type_at_pos_jsx.exp +++ b/tests/type_at_pos_jsx/type_at_pos_jsx.exp @@ -175,7 +175,7 @@ jsx_instantiation.js:105:6 Flags: (props: Props) => Node -'Node' defined at (lib) react.js:367:22 +'Node' defined at (lib) react.js:366:22 'Props' defined at jsx_instantiation.js:102:9 jsx_instantiation.js:105:6,105:8 @@ -184,7 +184,7 @@ jsx_instantiation.js:109:6 Flags: (props: Props) => Node -'Node' defined at (lib) react.js:367:22 +'Node' defined at (lib) react.js:366:22 'Props' defined at jsx_instantiation.js:102:9 jsx_instantiation.js:109:6,109:16 diff --git a/tests/type_at_pos_react/type_at_pos_react.exp b/tests/type_at_pos_react/type_at_pos_react.exp index c67224b42d1..1db4c67d117 100644 --- a/tests/type_at_pos_react/type_at_pos_react.exp +++ b/tests/type_at_pos_react/type_at_pos_react.exp @@ -2,7 +2,7 @@ lazy_ref.js:14:9 = { default: component(ref: RefSetter<{moo(x: string): void}>, ...empty) renders null } -'RefSetter' defined at (lib) react.js:1035:9 +'RefSetter' defined at (lib) react.js:1023:9 lazy_ref.js:14:9,14:9 lazy_ref.js:19:9 = Promise< @@ -10,7 +10,7 @@ lazy_ref.js:19:9 = Promise< > 'ExactReactElement_DEPRECATED' defined at (lib) react.js:179:13 -'Node' defined at (lib) react.js:367:22 +'Node' defined at (lib) react.js:366:22 'Promise' defined at (lib) core.js:2102:14 'Props' defined at exports-component.js:5:5 @@ -43,7 +43,7 @@ react_component.js:31:7 = { "expanded":{ "kind":"NominalComponentDecl", "name":{ - "provenance":{"kind":"Library (Remote)","loc":"[LIB] react.js:760:5,762:22"}, + "provenance":{"kind":"Library (Remote)","loc":"[LIB] react.js:748:5,750:22"}, "name":"Fragment" }, "typeParams":[ @@ -80,7 +80,7 @@ react_component.js:31:7 = { "expanded":{ "kind":"NominalComponentDecl", "name":{ - "provenance":{"kind":"Library (Remote)","loc":"[LIB] react.js:760:5,762:22"}, + "provenance":{"kind":"Library (Remote)","loc":"[LIB] react.js:748:5,750:22"}, "name":"Fragment" }, "typeParams":[ @@ -134,7 +134,7 @@ react_component.js:32:13 = { "kind":"Generic", "typeArgs":[{"kind":"Num"}], "type":{ - "provenance":{"kind":"Library (Remote)","loc":"[LIB] react.js:350:23-35"}, + "provenance":{"kind":"Library (Remote)","loc":"[LIB] react.js:349:23-35"}, "name":"ComponentType" }, "generic_kind":"type alias" @@ -162,7 +162,7 @@ react_component.js:32:29 = { "expanded":{ "kind":"TypeAlias", "name":{ - "provenance":{"kind":"Library (Remote)","loc":"[LIB] react.js:350:23-35"}, + "provenance":{"kind":"Library (Remote)","loc":"[LIB] react.js:349:23-35"}, "name":"ComponentType" }, "typeParams":[{"name":"P","bound":null,"polarity":"Negative"}], @@ -201,7 +201,7 @@ It serves as an alternative to writing JSX. **@see** https://react.dev/reference/react/createElement React$CreateElement -'React$CreateElement' defined at (lib) react.js:260:20 +'React$CreateElement' defined at (lib) react.js:259:20 react.js:4:7,4:19 diff --git a/tests/type_at_pos_type_destructors/type_at_pos_type_destructors.exp b/tests/type_at_pos_type_destructors/type_at_pos_type_destructors.exp index 5fc15fd3b97..0a927a1e65d 100644 --- a/tests/type_at_pos_type_destructors/type_at_pos_type_destructors.exp +++ b/tests/type_at_pos_type_destructors/type_at_pos_type_destructors.exp @@ -198,7 +198,7 @@ react-component.js:12:6 Flags: type ReactA = ElementProps -'ElementProps' defined at (lib) react.js:386:22 +'ElementProps' defined at (lib) react.js:385:22 'MyComponent' defined at react-component.js:5:6 'ReactA' defined at react-component.js:12:5 @@ -208,7 +208,7 @@ react-component.js:14:6 Flags: type ReactAP = ElementProps -'ElementProps' defined at (lib) react.js:386:22 +'ElementProps' defined at (lib) react.js:385:22 'ReactAP' defined at react-component.js:14:5 react-component.js:14:6,14:12 diff --git a/website/docs/react/types.md b/website/docs/react/types.md index ae8ed35f118..94f8c881ea8 100644 --- a/website/docs/react/types.md +++ b/website/docs/react/types.md @@ -293,7 +293,7 @@ type *of* a React component so you need to use `typeof` as in ## `React.Config` {#toc-react-config} :::warning -This type will be removed in 0.256.0. This type is usually only useful for legacy class components. +This type will be removed in 0.257.0. This type is usually only useful for legacy class components. You can create your own equivalent type with ```flow