Skip to content

Commit

Permalink
Replace React$Element that will cause an error in the future
Browse files Browse the repository at this point in the history
Summary:
For the ones where `React.MixedElement` would suffice, I change them to `React.MixedElement`. For everything else, I changed it to be `React.Element`

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D60798229

fbshipit-source-id: 40176b44769aade2c6b63a680d03c10056b2ddfa
  • Loading branch information
SamChou19815 authored and facebook-github-bot committed Aug 6, 2024
1 parent 740fd44 commit e1ec4c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions flow-typed/jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ type EnzymeMatchersType = {
toContainMatchingElement(selector: string): void,
toContainMatchingElements(n: number, selector: string): void,
toContainExactlyOneMatchingElement(selector: string): void,
toContainReact(element: React$Element<any>): void,
toContainReact(element: React.MixedElement): void,
toExist(): void,
toHaveClassName(className: string): void,
toHaveHTML(html: string): void,
Expand All @@ -263,7 +263,7 @@ type EnzymeMatchersType = {
toHaveValue(value: any): void,
toIncludeText(text: string): void,
toMatchElement(
element: React$Element<any>,
element: React.MixedElement,
options?: {|ignoreProps?: boolean, verbose?: boolean|},
): void,
toMatchSelector(selector: string): void,
Expand Down
17 changes: 7 additions & 10 deletions flow-typed/npm/react-test-renderer_v16.x.x.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// flow-typed signature: 7bac6c05f7415881918d3d510109e739
// flow-typed version: fce74493f0/react-test-renderer_v16.x.x/flow_>=v0.104.x

// Type definitions for react-test-renderer 16.x.x
// Ported from: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-test-renderer

Expand Down Expand Up @@ -44,14 +41,14 @@ type ReactTestInstance = {
...
};

type TestRendererOptions = { createNodeMock(element: React$Element<any>): any, ... };
type TestRendererOptions = { createNodeMock(element: React.MixedElement): any, ... };

declare module "react-test-renderer" {
declare export type ReactTestRenderer = {
toJSON(): null | ReactTestRendererJSON,
toTree(): null | ReactTestRendererTree,
unmount(nextElement?: React$Element<any>): void,
update(nextElement: React$Element<any>): void,
unmount(nextElement?: React.MixedElement): void,
update(nextElement: React.MixedElement): void,
getInstance(): ?ReactComponentInstance,
root: ReactTestInstance,
...
Expand All @@ -60,7 +57,7 @@ declare module "react-test-renderer" {
declare type Thenable = { then(resolve: () => mixed, reject?: () => mixed): mixed, ... };

declare function create(
nextElement: React$Element<any>,
nextElement: React.MixedElement,
options?: TestRendererOptions
): ReactTestRenderer;

Expand All @@ -71,9 +68,9 @@ declare module "react-test-renderer/shallow" {
declare export default class ShallowRenderer {
static createRenderer(): ShallowRenderer;
getMountedInstance(): ReactTestInstance;
getRenderOutput<E: React$Element<any>>(): E;
getRenderOutput(): React$Element<any>;
render(element: React$Element<any>, context?: any): void;
getRenderOutput<E: React.MixedElement>(): E;
getRenderOutput(): React.MixedElement;
render(element: React.MixedElement, context?: any): void;
unmount(): void;
}
}

0 comments on commit e1ec4c7

Please sign in to comment.