diff --git a/keyserver/flow-typed/npm/react-redux_v7.x.x.js b/keyserver/flow-typed/npm/react-redux_v7.x.x.js --- a/keyserver/flow-typed/npm/react-redux_v7.x.x.js +++ b/keyserver/flow-typed/npm/react-redux_v7.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: d2ddacbbca9700881249a9435381e689 -// flow-typed version: c6154227d1/react-redux_v7.x.x/flow_>=v0.89.x <=v0.103.x +// flow-typed signature: d3d375af4b8c9095e7360110a2a087fa +// flow-typed version: 6912183195/react-redux_v7.x.x/flow_>=v0.201.x /** The order of type arguments for connect() is as follows: @@ -67,16 +67,19 @@ // and provide the DispatchProps type to the DP type parameter. | ((dispatch: D, ownProps: OP) => (dispatch: D, ownProps: OP) => DP); - declare class ConnectedComponent extends React$Component { + declare class ConnectedComponentClass extends React$Component { static +WrappedComponent: WC; getWrappedInstance(): React$ElementRef; } + + declare export type ConnectedComponent = ConnectedComponentClass; + // The connection of the Wrapped Component and the Connected Component // happens here in `MP: P`. It means that type wise MP belongs to P, // so to say MP >= P. declare type Connector = >( WC, - ) => Class> & WC; + ) => Class> & WC; // No `mergeProps` argument @@ -203,7 +206,37 @@ // Typings for Hooks // ------------------------------------------------------------ - declare export function useDispatch(): D; + /* Action and AnyAction are taken from the redux TypeScript types defined here: + * https://github.com/reduxjs/redux/blob/d794c56f78eccb56ba3c67971c26df8ee34dacc1/src/types/actions.ts + * + * We turn them into objects so that they can be spread. + * + * We use AnyAction as the default for useDispatch as DefinitelyTyped does: + * https://github.com/DefinitelyTyped/DefinitelyTyped/blob/f7ec78508c6797e42f87a4390735bc2c650a1bfd/types/react-redux/index.d.ts#L540 + */ + declare export type Action = { + type: T, + ... + } + + declare export type AnyAction = { + ...Action, + [string]: any + } + + declare export type Dispatch<-A: Action> = (action: A, ...extraArgs: any[]) => mixed + + // Since A is contravariant in Dispatch, empty is a reasonable bound here. This is equivalent + // to using mixed as a default in a read-only position. + declare export function useDispatch = Dispatch>(): ( + & ((T) => T) + // Supports thunks at their various lengths and use cases depending if user has typed them as tuple vs array + & (((...args: [any]) => T) => T) + & (((...args: [any, any]) => T) => T) + & (((...args: [any, any, any]) => T) => T) + & (((...args: Array) => T) => T) + & D + ); declare export function useSelector( selector: (state: S) => SS, @@ -219,12 +252,13 @@ declare export class Provider extends React$Component<{ store: Store, children?: React$Node, + ... }> {} declare export function createProvider( storeKey?: string, subKey?: string, - ): Class>; + ): Class>; // ------------------------------------------------------------ // Typings for connectAdvanced() @@ -237,6 +271,7 @@ shouldHandleStateChanges?: boolean, storeKey?: string, forwardRef?: boolean, + ... }; declare type SelectorFactoryOptions = { @@ -249,6 +284,7 @@ displayName: string, wrappedComponentName: string, WrappedComponent: Com, + ... }; declare type MapStateToPropsEx = ( @@ -257,7 +293,7 @@ ) => RSP; declare type SelectorFactory< - Com: React$ComponentType<*>, + Com: React$ComponentType, Dispatch, S: Object, OP: Object, @@ -269,18 +305,22 @@ ) => MapStateToPropsEx; declare export function connectAdvanced< - Com: React$ComponentType<*>, + Com: React$ComponentType, D, S: Object, OP: Object, CP: Object, EFO: Object, - ST: { [_: $Keys]: any }, + ST: { [_: $Keys]: any, ... }, >( selectorFactory: SelectorFactory, connectAdvancedOptions: ?(ConnectAdvancedOptions & EFO), ): (component: Com) => React$ComponentType & $Shape; + declare export function batch(() => void): void + + declare export function shallowEqual(left: T, right: any): boolean + declare export default { Provider: typeof Provider, createProvider: typeof createProvider, @@ -289,5 +329,7 @@ useDispatch: typeof useDispatch, useSelector: typeof useSelector, useStore: typeof useStore, + batch: typeof batch, + ... }; } diff --git a/lib/flow-typed/npm/react-redux_v7.x.x.js b/lib/flow-typed/npm/react-redux_v7.x.x.js --- a/lib/flow-typed/npm/react-redux_v7.x.x.js +++ b/lib/flow-typed/npm/react-redux_v7.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: d2ddacbbca9700881249a9435381e689 -// flow-typed version: c6154227d1/react-redux_v7.x.x/flow_>=v0.89.x <=v0.103.x +// flow-typed signature: d3d375af4b8c9095e7360110a2a087fa +// flow-typed version: 6912183195/react-redux_v7.x.x/flow_>=v0.201.x /** The order of type arguments for connect() is as follows: @@ -67,16 +67,19 @@ // and provide the DispatchProps type to the DP type parameter. | ((dispatch: D, ownProps: OP) => (dispatch: D, ownProps: OP) => DP); - declare class ConnectedComponent extends React$Component { + declare class ConnectedComponentClass extends React$Component { static +WrappedComponent: WC; getWrappedInstance(): React$ElementRef; } + + declare export type ConnectedComponent = ConnectedComponentClass; + // The connection of the Wrapped Component and the Connected Component // happens here in `MP: P`. It means that type wise MP belongs to P, // so to say MP >= P. declare type Connector = >( WC, - ) => Class> & WC; + ) => Class> & WC; // No `mergeProps` argument @@ -203,7 +206,37 @@ // Typings for Hooks // ------------------------------------------------------------ - declare export function useDispatch(): D; + /* Action and AnyAction are taken from the redux TypeScript types defined here: + * https://github.com/reduxjs/redux/blob/d794c56f78eccb56ba3c67971c26df8ee34dacc1/src/types/actions.ts + * + * We turn them into objects so that they can be spread. + * + * We use AnyAction as the default for useDispatch as DefinitelyTyped does: + * https://github.com/DefinitelyTyped/DefinitelyTyped/blob/f7ec78508c6797e42f87a4390735bc2c650a1bfd/types/react-redux/index.d.ts#L540 + */ + declare export type Action = { + type: T, + ... + } + + declare export type AnyAction = { + ...Action, + [string]: any + } + + declare export type Dispatch<-A: Action> = (action: A, ...extraArgs: any[]) => mixed + + // Since A is contravariant in Dispatch, empty is a reasonable bound here. This is equivalent + // to using mixed as a default in a read-only position. + declare export function useDispatch = Dispatch>(): ( + & ((T) => T) + // Supports thunks at their various lengths and use cases depending if user has typed them as tuple vs array + & (((...args: [any]) => T) => T) + & (((...args: [any, any]) => T) => T) + & (((...args: [any, any, any]) => T) => T) + & (((...args: Array) => T) => T) + & D + ); declare export function useSelector( selector: (state: S) => SS, @@ -219,12 +252,13 @@ declare export class Provider extends React$Component<{ store: Store, children?: React$Node, + ... }> {} declare export function createProvider( storeKey?: string, subKey?: string, - ): Class>; + ): Class>; // ------------------------------------------------------------ // Typings for connectAdvanced() @@ -237,6 +271,7 @@ shouldHandleStateChanges?: boolean, storeKey?: string, forwardRef?: boolean, + ... }; declare type SelectorFactoryOptions = { @@ -249,6 +284,7 @@ displayName: string, wrappedComponentName: string, WrappedComponent: Com, + ... }; declare type MapStateToPropsEx = ( @@ -257,7 +293,7 @@ ) => RSP; declare type SelectorFactory< - Com: React$ComponentType<*>, + Com: React$ComponentType, Dispatch, S: Object, OP: Object, @@ -269,18 +305,22 @@ ) => MapStateToPropsEx; declare export function connectAdvanced< - Com: React$ComponentType<*>, + Com: React$ComponentType, D, S: Object, OP: Object, CP: Object, EFO: Object, - ST: { [_: $Keys]: any }, + ST: { [_: $Keys]: any, ... }, >( selectorFactory: SelectorFactory, connectAdvancedOptions: ?(ConnectAdvancedOptions & EFO), ): (component: Com) => React$ComponentType & $Shape; + declare export function batch(() => void): void + + declare export function shallowEqual(left: T, right: any): boolean + declare export default { Provider: typeof Provider, createProvider: typeof createProvider, @@ -289,5 +329,7 @@ useDispatch: typeof useDispatch, useSelector: typeof useSelector, useStore: typeof useStore, + batch: typeof batch, + ... }; } diff --git a/native/flow-typed/npm/react-redux_v7.x.x.js b/native/flow-typed/npm/react-redux_v7.x.x.js --- a/native/flow-typed/npm/react-redux_v7.x.x.js +++ b/native/flow-typed/npm/react-redux_v7.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: d2ddacbbca9700881249a9435381e689 -// flow-typed version: c6154227d1/react-redux_v7.x.x/flow_>=v0.89.x <=v0.103.x +// flow-typed signature: d3d375af4b8c9095e7360110a2a087fa +// flow-typed version: 6912183195/react-redux_v7.x.x/flow_>=v0.201.x /** The order of type arguments for connect() is as follows: @@ -67,16 +67,19 @@ // and provide the DispatchProps type to the DP type parameter. | ((dispatch: D, ownProps: OP) => (dispatch: D, ownProps: OP) => DP); - declare class ConnectedComponent extends React$Component { + declare class ConnectedComponentClass extends React$Component { static +WrappedComponent: WC; getWrappedInstance(): React$ElementRef; } + + declare export type ConnectedComponent = ConnectedComponentClass; + // The connection of the Wrapped Component and the Connected Component // happens here in `MP: P`. It means that type wise MP belongs to P, // so to say MP >= P. declare type Connector = >( WC, - ) => Class> & WC; + ) => Class> & WC; // No `mergeProps` argument @@ -203,7 +206,37 @@ // Typings for Hooks // ------------------------------------------------------------ - declare export function useDispatch(): D; + /* Action and AnyAction are taken from the redux TypeScript types defined here: + * https://github.com/reduxjs/redux/blob/d794c56f78eccb56ba3c67971c26df8ee34dacc1/src/types/actions.ts + * + * We turn them into objects so that they can be spread. + * + * We use AnyAction as the default for useDispatch as DefinitelyTyped does: + * https://github.com/DefinitelyTyped/DefinitelyTyped/blob/f7ec78508c6797e42f87a4390735bc2c650a1bfd/types/react-redux/index.d.ts#L540 + */ + declare export type Action = { + type: T, + ... + } + + declare export type AnyAction = { + ...Action, + [string]: any + } + + declare export type Dispatch<-A: Action> = (action: A, ...extraArgs: any[]) => mixed + + // Since A is contravariant in Dispatch, empty is a reasonable bound here. This is equivalent + // to using mixed as a default in a read-only position. + declare export function useDispatch = Dispatch>(): ( + & ((T) => T) + // Supports thunks at their various lengths and use cases depending if user has typed them as tuple vs array + & (((...args: [any]) => T) => T) + & (((...args: [any, any]) => T) => T) + & (((...args: [any, any, any]) => T) => T) + & (((...args: Array) => T) => T) + & D + ); declare export function useSelector( selector: (state: S) => SS, @@ -219,12 +252,13 @@ declare export class Provider extends React$Component<{ store: Store, children?: React$Node, + ... }> {} declare export function createProvider( storeKey?: string, subKey?: string, - ): Class>; + ): Class>; // ------------------------------------------------------------ // Typings for connectAdvanced() @@ -237,6 +271,7 @@ shouldHandleStateChanges?: boolean, storeKey?: string, forwardRef?: boolean, + ... }; declare type SelectorFactoryOptions = { @@ -249,6 +284,7 @@ displayName: string, wrappedComponentName: string, WrappedComponent: Com, + ... }; declare type MapStateToPropsEx = ( @@ -257,7 +293,7 @@ ) => RSP; declare type SelectorFactory< - Com: React$ComponentType<*>, + Com: React$ComponentType, Dispatch, S: Object, OP: Object, @@ -269,18 +305,22 @@ ) => MapStateToPropsEx; declare export function connectAdvanced< - Com: React$ComponentType<*>, + Com: React$ComponentType, D, S: Object, OP: Object, CP: Object, EFO: Object, - ST: { [_: $Keys]: any }, + ST: { [_: $Keys]: any, ... }, >( selectorFactory: SelectorFactory, connectAdvancedOptions: ?(ConnectAdvancedOptions & EFO), ): (component: Com) => React$ComponentType & $Shape; + declare export function batch(() => void): void + + declare export function shallowEqual(left: T, right: any): boolean + declare export default { Provider: typeof Provider, createProvider: typeof createProvider, @@ -289,5 +329,7 @@ useDispatch: typeof useDispatch, useSelector: typeof useSelector, useStore: typeof useStore, + batch: typeof batch, + ... }; } diff --git a/web/flow-typed/npm/react-redux_v7.x.x.js b/web/flow-typed/npm/react-redux_v7.x.x.js --- a/web/flow-typed/npm/react-redux_v7.x.x.js +++ b/web/flow-typed/npm/react-redux_v7.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: d2ddacbbca9700881249a9435381e689 -// flow-typed version: c6154227d1/react-redux_v7.x.x/flow_>=v0.89.x <=v0.103.x +// flow-typed signature: d3d375af4b8c9095e7360110a2a087fa +// flow-typed version: 6912183195/react-redux_v7.x.x/flow_>=v0.201.x /** The order of type arguments for connect() is as follows: @@ -67,16 +67,19 @@ // and provide the DispatchProps type to the DP type parameter. | ((dispatch: D, ownProps: OP) => (dispatch: D, ownProps: OP) => DP); - declare class ConnectedComponent extends React$Component { + declare class ConnectedComponentClass extends React$Component { static +WrappedComponent: WC; getWrappedInstance(): React$ElementRef; } + + declare export type ConnectedComponent = ConnectedComponentClass; + // The connection of the Wrapped Component and the Connected Component // happens here in `MP: P`. It means that type wise MP belongs to P, // so to say MP >= P. declare type Connector = >( WC, - ) => Class> & WC; + ) => Class> & WC; // No `mergeProps` argument @@ -203,7 +206,37 @@ // Typings for Hooks // ------------------------------------------------------------ - declare export function useDispatch(): D; + /* Action and AnyAction are taken from the redux TypeScript types defined here: + * https://github.com/reduxjs/redux/blob/d794c56f78eccb56ba3c67971c26df8ee34dacc1/src/types/actions.ts + * + * We turn them into objects so that they can be spread. + * + * We use AnyAction as the default for useDispatch as DefinitelyTyped does: + * https://github.com/DefinitelyTyped/DefinitelyTyped/blob/f7ec78508c6797e42f87a4390735bc2c650a1bfd/types/react-redux/index.d.ts#L540 + */ + declare export type Action = { + type: T, + ... + } + + declare export type AnyAction = { + ...Action, + [string]: any + } + + declare export type Dispatch<-A: Action> = (action: A, ...extraArgs: any[]) => mixed + + // Since A is contravariant in Dispatch, empty is a reasonable bound here. This is equivalent + // to using mixed as a default in a read-only position. + declare export function useDispatch = Dispatch>(): ( + & ((T) => T) + // Supports thunks at their various lengths and use cases depending if user has typed them as tuple vs array + & (((...args: [any]) => T) => T) + & (((...args: [any, any]) => T) => T) + & (((...args: [any, any, any]) => T) => T) + & (((...args: Array) => T) => T) + & D + ); declare export function useSelector( selector: (state: S) => SS, @@ -219,12 +252,13 @@ declare export class Provider extends React$Component<{ store: Store, children?: React$Node, + ... }> {} declare export function createProvider( storeKey?: string, subKey?: string, - ): Class>; + ): Class>; // ------------------------------------------------------------ // Typings for connectAdvanced() @@ -237,6 +271,7 @@ shouldHandleStateChanges?: boolean, storeKey?: string, forwardRef?: boolean, + ... }; declare type SelectorFactoryOptions = { @@ -249,6 +284,7 @@ displayName: string, wrappedComponentName: string, WrappedComponent: Com, + ... }; declare type MapStateToPropsEx = ( @@ -257,7 +293,7 @@ ) => RSP; declare type SelectorFactory< - Com: React$ComponentType<*>, + Com: React$ComponentType, Dispatch, S: Object, OP: Object, @@ -269,18 +305,22 @@ ) => MapStateToPropsEx; declare export function connectAdvanced< - Com: React$ComponentType<*>, + Com: React$ComponentType, D, S: Object, OP: Object, CP: Object, EFO: Object, - ST: { [_: $Keys]: any }, + ST: { [_: $Keys]: any, ... }, >( selectorFactory: SelectorFactory, connectAdvancedOptions: ?(ConnectAdvancedOptions & EFO), ): (component: Com) => React$ComponentType & $Shape; + declare export function batch(() => void): void + + declare export function shallowEqual(left: T, right: any): boolean + declare export default { Provider: typeof Provider, createProvider: typeof createProvider, @@ -289,5 +329,7 @@ useDispatch: typeof useDispatch, useSelector: typeof useSelector, useStore: typeof useStore, + batch: typeof batch, + ... }; }