reactotron-redux
Advanced tools
+7
-0
@@ -5,2 +5,9 @@ # Changelog | ||
| ### [3.1.5](https://github.com/infinitered/reactotron/compare/reactotron-redux@3.1.4...reactotron-redux@3.1.5) (2024-01-09) | ||
| ### Bug Fixes | ||
| * update client types in reactotron-react-native-mmkv and reactotron-redux ([#1397](https://github.com/infinitered/reactotron/issues/1397)) ([1478ea1](https://github.com/infinitered/reactotron/commit/1478ea176552b9e0e6606a41f4cc2cd3a33fe587)), closes [#1391](https://github.com/infinitered/reactotron/issues/1391) | ||
| ### [3.1.4](https://github.com/infinitered/reactotron/compare/reactotron-redux@3.1.4-beta.17...reactotron-redux@3.1.4) (2023-12-05) | ||
@@ -7,0 +14,0 @@ |
@@ -1,6 +0,6 @@ | ||
| import { Reactotron } from "reactotron-core-client"; | ||
| import { ReactotronCore } from "reactotron-core-client"; | ||
| import { PluginConfig } from "./pluginConfig"; | ||
| export default function createCommandHandler(reactotron: Reactotron, pluginConfig: PluginConfig, onReduxStoreCreation: (func: () => void) => void): ({ type, payload }: { | ||
| export default function createCommandHandler<Client extends ReactotronCore = ReactotronCore>(reactotron: Client, pluginConfig: PluginConfig, onReduxStoreCreation: (func: () => void) => void): ({ type, payload }: { | ||
| type: string; | ||
| payload?: any; | ||
| }) => void; |
@@ -1,3 +0,3 @@ | ||
| import { Reactotron } from "reactotron-core-client"; | ||
| import type { ReactotronCore } from "reactotron-core-client"; | ||
| import { PluginConfig } from "./pluginConfig"; | ||
| export default function createEnhancer(reactotron: Reactotron, pluginConfig: PluginConfig, handleStoreCreation: () => void): (skipSettingStore?: boolean) => (createStore: any) => (reducer: any, ...args: any[]) => any; | ||
| export default function createEnhancer<Client extends ReactotronCore = ReactotronCore>(reactotron: Client, pluginConfig: PluginConfig, handleStoreCreation: () => void): (skipSettingStore?: boolean) => (createStore: any) => (reducer: any, ...args: any[]) => any; |
@@ -1,5 +0,4 @@ | ||
| import type { StoreEnhancer } from "redux"; | ||
| import { Reactotron } from "reactotron-core-client"; | ||
| import type { ReactotronCore } from "reactotron-core-client"; | ||
| import { PluginConfig } from "./pluginConfig"; | ||
| declare function reactotronRedux(pluginConfig?: PluginConfig): (reactotron: Reactotron) => { | ||
| declare function reactotronRedux<Client extends ReactotronCore = ReactotronCore>(pluginConfig?: PluginConfig): (reactotron: Client) => { | ||
| onCommand: ({ type, payload }: { | ||
@@ -17,15 +16,3 @@ type: string; | ||
| }; | ||
| export type ReactotronReduxPlugin<Client extends ReactotronCore = ReactotronCore> = ReturnType<typeof reactotronRedux<Client>>; | ||
| export { reactotronRedux }; | ||
| declare module "reactotron-core-client" { | ||
| interface Reactotron { | ||
| reduxStore?: any; | ||
| /** | ||
| * Enhancer creator | ||
| */ | ||
| createEnhancer?: (skipSettingStore?: boolean) => StoreEnhancer; | ||
| /** | ||
| * Store setter | ||
| */ | ||
| setReduxStore?: (store: any) => void; | ||
| } | ||
| } |
@@ -1,4 +0,4 @@ | ||
| import { Reactotron } from "reactotron-core-client"; | ||
| export default function createSendAction(reactotron: Reactotron): (action: { | ||
| import type { ReactotronCore } from "reactotron-core-client"; | ||
| export default function createSendAction<Client extends ReactotronCore = ReactotronCore>(reactotron: Client): (action: { | ||
| type: any; | ||
| }, ms: number, important?: boolean) => void; |
@@ -1,2 +0,3 @@ | ||
| import type { Reactotron } from "reactotron-core-client"; | ||
| export declare const defaultReactotronMock: Reactotron; | ||
| import type { InferFeatures, Reactotron } from "reactotron-core-client"; | ||
| import type { ReactotronReduxPlugin } from "."; | ||
| export declare const defaultReactotronMock: Reactotron & InferFeatures<Reactotron, ReactotronReduxPlugin<Reactotron>>; |
+1
-1
| { | ||
| "name": "reactotron-redux", | ||
| "version": "3.1.4", | ||
| "version": "3.1.5", | ||
| "description": "A Reactotron plugin for Redux.", | ||
@@ -5,0 +5,0 @@ "author": "Infinite Red", |
| import { | ||
| InferFeatures, | ||
| Reactotron, | ||
| ReactotronCore, | ||
| StateResponsePlugin, | ||
@@ -13,4 +13,4 @@ assertHasStateResponsePlugin, | ||
| export default function createCommandHandler( | ||
| reactotron: Reactotron, | ||
| export default function createCommandHandler<Client extends ReactotronCore = ReactotronCore>( | ||
| reactotron: Client, | ||
| pluginConfig: PluginConfig, | ||
@@ -21,3 +21,3 @@ onReduxStoreCreation: (func: () => void) => void | ||
| assertHasStateResponsePlugin(reactotron) | ||
| const client = reactotron as Reactotron & InferFeatures<Reactotron, StateResponsePlugin> | ||
| const client = reactotron as Client & InferFeatures<Client, StateResponsePlugin> | ||
@@ -28,2 +28,4 @@ // create our subscriptions handler | ||
| return ({ type, payload }: { type: string; payload?: any }) => { | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore shhhhhh -- this is a private API | ||
| const reduxStore = client.reduxStore | ||
@@ -94,2 +96,4 @@ | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore shhhhhh -- this is a private API | ||
| client.reduxStore.dispatch({ | ||
@@ -96,0 +100,0 @@ type: pluginConfig.restoreActionType, |
+5
-3
@@ -1,2 +0,2 @@ | ||
| import { Reactotron } from "reactotron-core-client" | ||
| import type { ReactotronCore } from "reactotron-core-client" | ||
@@ -7,4 +7,4 @@ import reactotronReducer from "./reducer" | ||
| export default function createEnhancer( | ||
| reactotron: Reactotron, | ||
| export default function createEnhancer<Client extends ReactotronCore = ReactotronCore>( | ||
| reactotron: Client, | ||
| pluginConfig: PluginConfig, | ||
@@ -26,2 +26,4 @@ handleStoreCreation: () => void | ||
| if (!skipSettingStore) { | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore shhhhhh -- this is a private API | ||
| reactotron.reduxStore = store | ||
@@ -28,0 +30,0 @@ handleStoreCreation() |
+12
-22
@@ -1,3 +0,2 @@ | ||
| import type { StoreEnhancer } from "redux" | ||
| import { Plugin, Reactotron } from "reactotron-core-client" | ||
| import type { Plugin, Reactotron, ReactotronCore } from "reactotron-core-client" | ||
@@ -10,3 +9,5 @@ import createCommandHander from "./commandHandler" | ||
| function reactotronRedux(pluginConfig: PluginConfig = {}) { | ||
| function reactotronRedux<Client extends ReactotronCore = ReactotronCore>( | ||
| pluginConfig: PluginConfig = {} | ||
| ) { | ||
| const mergedPluginConfig: PluginConfig = { | ||
@@ -17,3 +18,3 @@ ...pluginConfig, | ||
| const storeCreationHandlers = [] | ||
| const storeCreationHandlers: (() => void)[] = [] | ||
| const onReduxStoreCreation = (func: () => void) => { | ||
@@ -28,3 +29,3 @@ storeCreationHandlers.push(func) | ||
| return (reactotron: Reactotron) => { | ||
| return (reactotron: Client) => { | ||
| return { | ||
@@ -35,2 +36,4 @@ onCommand: createCommandHander(reactotron, mergedPluginConfig, onReduxStoreCreation), | ||
| setReduxStore: (store) => { | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore shhhhhh -- this is a private API | ||
| reactotron.reduxStore = store | ||
@@ -45,19 +48,6 @@ handleStoreCreation() | ||
| export type ReactotronReduxPlugin<Client extends ReactotronCore = ReactotronCore> = ReturnType< | ||
| typeof reactotronRedux<Client> | ||
| > | ||
| export { reactotronRedux } | ||
| declare module "reactotron-core-client" { | ||
| // eslint-disable-next-line import/export | ||
| export interface Reactotron { | ||
| reduxStore?: any | ||
| /** | ||
| * Enhancer creator | ||
| */ | ||
| createEnhancer?: (skipSettingStore?: boolean) => StoreEnhancer | ||
| /** | ||
| * Store setter | ||
| */ | ||
| setReduxStore?: (store: any) => void | ||
| } | ||
| } |
@@ -1,4 +0,6 @@ | ||
| import { Reactotron } from "reactotron-core-client" | ||
| import type { ReactotronCore } from "reactotron-core-client" | ||
| export default function createSendAction(reactotron: Reactotron) { | ||
| export default function createSendAction<Client extends ReactotronCore = ReactotronCore>( | ||
| reactotron: Client | ||
| ) { | ||
| return (action: { type: any }, ms: number, important = false) => { | ||
@@ -5,0 +7,0 @@ // let's call the type, name because that's "generic" name in Reactotron |
@@ -1,4 +0,6 @@ | ||
| import type { Reactotron } from "reactotron-core-client" | ||
| import type { InferFeatures, Reactotron } from "reactotron-core-client" | ||
| import type { ReactotronReduxPlugin } from "." | ||
| export const defaultReactotronMock: Reactotron = { | ||
| export const defaultReactotronMock: Reactotron & | ||
| InferFeatures<Reactotron, ReactotronReduxPlugin<Reactotron>> = { | ||
| startTimer: jest.fn(), | ||
@@ -30,4 +32,6 @@ configure: jest.fn(), | ||
| createEnhancer: jest.fn(), | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore shhhhhh -- this is a private API | ||
| reduxStore: jest.fn(), | ||
| setReduxStore: jest.fn(), | ||
| } |
65873
1.98%1198
-0.66%