Skip to content

Commit

Permalink
[flow] Kill React$PureComponent
Browse files Browse the repository at this point in the history
Summary: Changelog: [lib] The global `React$PureComponent` is removed. If you want to refer to it, it needs to be imported from `react`.

Reviewed By: panagosg7

Differential Revision:
D69490345

------------------------------------------------------------------------
(from 5d72b71d48d06bd02e652879490d4a6a47567a96)

fbshipit-source-id: ab0f00571c6658c474830fcb6426907980588a02
  • Loading branch information
SamChou19815 authored and facebook-github-bot committed Feb 12, 2025
1 parent cdb4f54 commit ee13d19
Show file tree
Hide file tree
Showing 32 changed files with 691 additions and 696 deletions.
10 changes: 3 additions & 7 deletions lib/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ declare class React$Component<Props, State = void> {
// static defaultProps: $Shape<Props>;
}

declare class React$PureComponent<Props, State = void>
extends React$Component<Props, State> {
}

declare type React$AbstractComponentStatics = {
displayName?: ?string,
// This is only on function components, but trying to access name when
Expand Down Expand Up @@ -203,7 +199,7 @@ declare type React$RefSetter<-T> =
* The type of a React Context. React Contexts are created by calling
* createContext() with a default value.
*/
declare opaque type React$Context<T>:
declare opaque type React$Context<T>:
component<Renders: React$Node = React$Node>(value: T, children?: Renders, ...{...}) renders Renders
& {
Provider: component<Renders: React$Node = React$Node>(value: T, children?: Renders, ...{...}) renders Renders,
Expand Down Expand Up @@ -341,7 +337,7 @@ declare module react {
*
* @see https://react.dev/reference/react/PureComponent
*/
declare export const PureComponent: typeof React$PureComponent;
declare export const PureComponent: typeof React.PureComponent;
declare export type ComponentType<-P> = React$ComponentType<P>;
declare export type PropsOf<C: string | React$MixedElement | React$RendersExactly<React$ElementType>> = React.PropsOf<C>;
declare export type PropOf<C: string | React$MixedElement | React$RendersExactly<React$ElementType>, K: string> = React.PropOf<C, K>;
Expand Down Expand Up @@ -725,7 +721,7 @@ declare module react {
*
* @see https://react.dev/reference/react/PureComponent
*/
declare const PureComponent: typeof React$PureComponent;
declare export class PureComponent<Props, State = void> extends Component<Props, State> {}

declare function forwardRef<
Config: {...},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,6 @@ Flags: --pretty
{"name":"Range","type":"typeof Range"},
{"name":"RangeError","type":"typeof RangeError"},
{"name":"React$Component","type":"typeof React$Component"},
{"name":"React$PureComponent","type":"typeof React$PureComponent"},
{
"name":"ReadableByteStreamController",
"type":"typeof ReadableByteStreamController"
Expand Down
4 changes: 2 additions & 2 deletions tests/badly_positioned_react/badly_positioned_react.exp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ References:
test.js:21:29
21| const Foo1 = create(create1<{||}>(Foo));
^^^^ [2]
<BUILTINS>/react.js:345:38
345| declare export type ComponentType<-P> = React$ComponentType<P>;
<BUILTINS>/react.js:341:38
341| declare export type ComponentType<-P> = React$ComponentType<P>;
^ [3]


Expand Down
Loading

0 comments on commit ee13d19

Please sign in to comment.