Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 24 additions & 26 deletions flow-typed/npm/react-dom_v17.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,44 @@ declare module 'react-dom' {
declare var version: string;

declare function findDOMNode(
componentOrElement: Element | ?Component<any, any>
componentOrElement: Element | ?Component<any, any>,
): null | Element | Text;

declare function render<ElementType: React.ElementType>(
element: ExactReactElement_DEPRECATED<ElementType>,
container: Element,
callback?: () => void
callback?: () => void,
): React.ElementRef<ElementType>;

declare function hydrate<ElementType: React.ElementType>(
element: ExactReactElement_DEPRECATED<ElementType>,
container: Element,
callback?: () => void
callback?: () => void,
): React.ElementRef<ElementType>;

declare function createPortal(
node: React.Node,
container: Element
container: Element,
): React.Portal;

declare function unmountComponentAtNode(container: any): boolean;

declare function unstable_batchedUpdates<A, B, C, D, E>(
callback: (a: A, b: B, c: C, d: D, e: E) => mixed,
callback: (a: A, b: B, c: C, d: D, e: E) => unknown,
a: A,
b: B,
c: C,
d: D,
e: E
e: E,
): void;

declare function unstable_renderSubtreeIntoContainer<
ElementType: React.ElementType
ElementType: React.ElementType,
>(
parentComponent: Component<any, any>,
nextElement: ExactReactElement_DEPRECATED<ElementType>,
container: any,
callback?: () => void
callback?: () => void,
): React.ElementRef<ElementType>;
}

Expand All @@ -55,85 +55,83 @@ declare module 'react-dom/server' {
declare function renderToNodeStream(element: React.Node): stream$Readable;

declare function renderToStaticNodeStream(
element: React.Node
element: React.Node,
): stream$Readable;
}

declare module 'react-dom/test-utils' {
import type {Component} from 'react';

declare interface Thenable {
then(resolve: () => mixed, reject?: () => mixed): mixed,
then(resolve: () => unknown, reject?: () => unknown): unknown;
}

declare var Simulate: {
[eventName: string]: (
element: Element,
eventData?: { [key: string]: mixed, ... }
eventData?: {[key: string]: unknown, ...},
) => void,
...
};

declare function renderIntoDocument(
instance: React.MixedElement
instance: React.MixedElement,
): Component<any, any>;

declare function mockComponent(
componentClass: React.ElementType,
mockTagName?: string
): { [key: string]: mixed, ... };
mockTagName?: string,
): {[key: string]: unknown, ...};

declare function isElement(element: React.MixedElement): boolean;

declare function isElementOfType(
element: React.MixedElement,
componentClass: React.ElementType
componentClass: React.ElementType,
): boolean;

declare function isDOMComponent(instance: any): boolean;

declare function isCompositeComponent(
instance: Component<any, any>
): boolean;
declare function isCompositeComponent(instance: Component<any, any>): boolean;

declare function isCompositeComponentWithType(
instance: Component<any, any>,
componentClass: React.ElementType
componentClass: React.ElementType,
): boolean;

declare function findAllInRenderedTree(
tree: Component<any, any>,
test: (child: Component<any, any>) => boolean
test: (child: Component<any, any>) => boolean,
): Array<Component<any, any>>;

declare function scryRenderedDOMComponentsWithClass(
tree: Component<any, any>,
className: string
className: string,
): Array<Element>;

declare function findRenderedDOMComponentWithClass(
tree: Component<any, any>,
className: string
className: string,
): ?Element;

declare function scryRenderedDOMComponentsWithTag(
tree: Component<any, any>,
tagName: string
tagName: string,
): Array<Element>;

declare function findRenderedDOMComponentWithTag(
tree: Component<any, any>,
tagName: string
tagName: string,
): ?Element;

declare function scryRenderedComponentsWithType(
tree: Component<any, any>,
componentClass: React.ElementType
componentClass: React.ElementType,
): Array<Component<any, any>>;

declare function findRenderedComponentWithType(
tree: Component<any, any>,
componentClass: React.ElementType
componentClass: React.ElementType,
): ?Component<any, any>;

declare function act(callback: () => void | Thenable): Thenable;
Expand Down
32 changes: 19 additions & 13 deletions flow-typed/npm/react-test-renderer_v16.x.x.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
// Type definitions for react-test-renderer 16.x.x
// Ported from: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-test-renderer

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

declare module "react-test-renderer" {
declare module 'react-test-renderer' {
import type {Component as ReactComponent} from 'react';

type ReactComponentInstance = ReactComponent<any>;

export type ReactTestRendererJSON = {
type: string,
props: { [propName: string]: any, ... },
props: {[propName: string]: any, ...},
children: null | ReactTestRendererJSON[],
...
};

export type ReactTestRendererTree = ReactTestRendererJSON & {
nodeType: "component" | "host",
nodeType: 'component' | 'host',
instance: ?ReactComponentInstance,
rendered: null | ReactTestRendererTree,
...
Expand All @@ -25,23 +28,23 @@ declare module "react-test-renderer" {
export type ReactTestInstance = {
instance: ?ReactComponentInstance,
type: string,
props: { [propName: string]: any, ... },
props: {[propName: string]: any, ...},
parent: null | ReactTestInstance,
children: Array<ReactTestInstance | string>,
find(predicate: (node: ReactTestInstance) => boolean): ReactTestInstance,
findByType(type: React.ElementType): ReactTestInstance,
findByProps(props: { [propName: string]: any, ... }): ReactTestInstance,
findByProps(props: {[propName: string]: any, ...}): ReactTestInstance,
findAll(
predicate: (node: ReactTestInstance) => boolean,
options?: { deep: boolean, ... }
options?: {deep: boolean, ...},
): ReactTestInstance[],
findAllByType(
type: React.ElementType,
options?: { deep: boolean, ... }
options?: {deep: boolean, ...},
): ReactTestInstance[],
findAllByProps(
props: { [propName: string]: any, ... },
options?: { deep: boolean, ... }
props: {[propName: string]: any, ...},
options?: {deep: boolean, ...},
): ReactTestInstance[],
...
};
Expand All @@ -56,17 +59,20 @@ declare module "react-test-renderer" {
...
};

declare type Thenable = { then(resolve: () => mixed, reject?: () => mixed): mixed, ... };
declare type Thenable = {
then(resolve: () => unknown, reject?: () => unknown): unknown,
...
};

declare function create(
nextElement: React.MixedElement,
options?: TestRendererOptions
options?: TestRendererOptions,
): ReactTestRenderer;

declare function act(callback: () => void | Promise<void>): Thenable;
}

declare module "react-test-renderer/shallow" {
declare module 'react-test-renderer/shallow' {
import type {ReactTestInstance} from 'react-test-renderer';

declare export default class ShallowRenderer {
Expand Down
21 changes: 15 additions & 6 deletions flow-typed/npm/tinyglobby_v0.2.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,27 @@ declare module 'tinyglobby' {
followSymbolicLinks?: boolean,
fs?: FileSystemAdapter,
globstar?: boolean,
ignore?: string | $ReadOnlyArray<string>,
ignore?: string | ReadonlyArray<string>,
onlyDirectories?: boolean,
onlyFiles?: boolean,
signal?: AbortSignal,
};

declare type GlobModule = {
convertPathToPattern(path: string): string;
escapePath(path: string): string;
isDynamicPattern(pattern: string, options?: { caseSensitiveMatch: boolean }): boolean;
glob(patterns: string | $ReadOnlyArray<string>, options?: GlobOptions): Promise<string[]>;
globSync(patterns: string | $ReadOnlyArray<string>, options?: GlobOptions): string[];
convertPathToPattern(path: string): string,
escapePath(path: string): string,
isDynamicPattern(
pattern: string,
options?: {caseSensitiveMatch: boolean},
): boolean,
glob(
patterns: string | ReadonlyArray<string>,
options?: GlobOptions,
): Promise<string[]>,
globSync(
patterns: string | ReadonlyArray<string>,
options?: GlobOptions,
): string[],
};

declare module.exports: GlobModule;
Expand Down
Loading
Loading