MigrationMap
Type Alias: MigrationMap<TState>
Section titled “Type Alias: MigrationMap<TState>”MigrationMap<
TState> =Record<number, (persistedState) =>Partial<TState>>
Defined in: types.ts:57
A migration step that transforms persisted state from one version to the next.
Migrations run in order from the persisted version up to the current version. Each migration must return state shaped for its target version.
Type Parameters
Section titled “Type Parameters”TState
Section titled “TState”TState
Example
Section titled “Example”const migrations: MigrationMap<UserState> = { 2: (oldState) => ({ ...oldState, prefs: oldState.preferences }),};