diff --git a/src/middleware/devtools.ts b/src/middleware/devtools.ts index 1d029cbb..5be3b621 100644 --- a/src/middleware/devtools.ts +++ b/src/middleware/devtools.ts @@ -1,6 +1,76 @@ -import type { Config } from '@redux-devtools/extension' +import type {} from '@redux-devtools/extension' import { StateCreator, StoreApi, StoreMutatorIdentifier } from '../vanilla' +// Copy types to avoid import type { Config } from '@redux-devtools/extension' +// https://github.com/pmndrs/zustand/issues/1205 +type Action = { + type: T +} +type ActionCreator = { + (...args: P): A +} +type EnhancerOptions = { + name?: string + actionCreators?: + | ActionCreator[] + | { + [key: string]: ActionCreator + } + latency?: number + maxAge?: number + serialize?: + | boolean + | { + options?: + | undefined + | boolean + | { + date?: true + regex?: true + undefined?: true + error?: true + symbol?: true + map?: true + set?: true + function?: true | ((fn: (...args: any[]) => any) => string) + } + replacer?: (key: string, value: unknown) => any + reviver?: (key: string, value: unknown) => any + immutable?: any + refs?: any + } + actionSanitizer?: (action: A, id: number) => A + stateSanitizer?: (state: S, index: number) => S + actionsBlacklist?: string | string[] + actionsWhitelist?: string | string[] + actionsDenylist?: string | string[] + actionsAllowlist?: string | string[] + predicate?: (state: S, action: A) => boolean + shouldRecordChanges?: boolean + pauseActionType?: string + autoPause?: boolean + shouldStartLocked?: boolean + shouldHotReload?: boolean + shouldCatchErrors?: boolean + features?: { + pause?: boolean + lock?: boolean + persist?: boolean + export?: boolean | 'custom' + import?: boolean | 'custom' + jump?: boolean + skip?: boolean + reorder?: boolean + dispatch?: boolean + test?: boolean + } + trace?: boolean | ((action: A) => string) + traceLimit?: number +} +type Config = EnhancerOptions & { + type?: string +} + declare module '../vanilla' { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface StoreMutators {