mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
fix(types)(middleware/devtools): copy devtools option types instead of importing (#1207)
This commit is contained in:
parent
ca0786fe47
commit
e1e83e3160
@ -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<T = any> = {
|
||||
type: T
|
||||
}
|
||||
type ActionCreator<A, P extends any[] = any[]> = {
|
||||
(...args: P): A
|
||||
}
|
||||
type EnhancerOptions = {
|
||||
name?: string
|
||||
actionCreators?:
|
||||
| ActionCreator<any>[]
|
||||
| {
|
||||
[key: string]: ActionCreator<any>
|
||||
}
|
||||
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?: <A extends Action>(action: A, id: number) => A
|
||||
stateSanitizer?: <S>(state: S, index: number) => S
|
||||
actionsBlacklist?: string | string[]
|
||||
actionsWhitelist?: string | string[]
|
||||
actionsDenylist?: string | string[]
|
||||
actionsAllowlist?: string | string[]
|
||||
predicate?: <S, A extends Action>(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 | (<A extends Action>(action: A) => string)
|
||||
traceLimit?: number
|
||||
}
|
||||
type Config = EnhancerOptions & {
|
||||
type?: string
|
||||
}
|
||||
|
||||
declare module '../vanilla' {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
interface StoreMutators<S, A> {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user