Skip to content

Commit

Permalink
chore(deps): update dependency pinia to v2.3.0 (#701)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency pinia to v2.3.0

* fix: type

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ernest <[email protected]>
  • Loading branch information
renovate[bot] and soc221b authored Dec 15, 2024
1 parent 881f7c9 commit 4953f62
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 44 deletions.
70 changes: 33 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"shvl": "^3.0.0"
},
"peerDependencies": {
"pinia": "^2.2.2"
"pinia": "^2.3.0"
},
"devDependencies": {
"@babel/core": "7.26.0",
Expand All @@ -63,7 +63,7 @@
"husky": "9.1.7",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"pinia": "2.2.2",
"pinia": "2.3.0",
"prettier": "3.4.2",
"rimraf": "6.0.1",
"size-limit": "11.1.6",
Expand Down
4 changes: 2 additions & 2 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,13 @@ export function createPersistedStatePlugin<S extends StateTree = StateTree>(
}, {} as any)
}
if (Array.isArray(options.excludePaths)) {
state = deserialize(serialize(state))
state = deserialize(serialize(state as any))
options.excludePaths.forEach(function (path) {
return shvl.set(state, path, void 0, void 0)
}, {})
}

const value = serialize(state)
const value = serialize(state as any)
const result = storage.setItem(key, value)
if (result instanceof Promise) {
++pendingCount
Expand Down
7 changes: 4 additions & 3 deletions src/type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { StateTree, SubscriptionCallback } from 'pinia'
import { UnwrapRef } from 'vue'

export interface IStorage {
getItem: (key: string) => any | Promise<any>
Expand Down Expand Up @@ -47,7 +48,7 @@ export interface CommonOptions<S extends StateTree = StateTree> {
*
* @default (state, savedState) => savedState
*/
merge?: (state: S, savedState: S) => S
merge?: (state: UnwrapRef<S>, savedState: UnwrapRef<S>) => UnwrapRef<S>

/**
* When rehydrating, overwrite initial state (patch otherwise).
Expand All @@ -61,7 +62,7 @@ export interface CommonOptions<S extends StateTree = StateTree> {
*
* @default JSON.stringify
*/
serialize?: (state: S) => any
serialize?: (state: UnwrapRef<S>) => any

/**
* This method will be called right after `storage.getItem`.
Expand Down Expand Up @@ -123,7 +124,7 @@ export type StoreOptions<S extends StateTree> = CommonOptions<S> & {
*
* @default {value => value}
*/
beforeHydrate?: (oldState: S) => void
beforeHydrate?: (oldState: UnwrapRef<S>) => void
}

declare module 'pinia' {
Expand Down

0 comments on commit 4953f62

Please sign in to comment.