Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-shi committed Feb 25, 2024
1 parent 54fdc95 commit 75cabcb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/vanilla/utils/atomWithStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export interface SyncStringStorage {
export function withStorageValidator<Value>(
validator: (value: unknown) => value is Value,
): {
<T>(storage: AsyncStorage<T>): AsyncStorage<Value>
<T>(storage: SyncStorage<T>): SyncStorage<Value>
(storage: AsyncStorage<unknown>): AsyncStorage<Value>
(storage: SyncStorage<unknown>): SyncStorage<Value>
}

export function withStorageValidator<Value>(
Expand Down
4 changes: 2 additions & 2 deletions tests/react/vanilla-utils/atomWithStorage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ describe('atomWithStorage (with browser storage)', () => {
if (!get(isLoggedAtom)) return false
return get(isDevModeStorageAtom)
},
(get, set, value: boolean) => {
(_get, set, value: boolean) => {
set(isDevModeStorageAtom, value)
},
)
Expand Down Expand Up @@ -596,7 +596,7 @@ describe('atomWithStorage (with non-browser storage)', () => {

describe('withStorageValidator', () => {
it('should use withStorageValidator with isNumber', () => {
const storage = createJSONStorage<number>()
const storage = createJSONStorage()
const isNumber = (v: unknown): v is number => typeof v === 'number'
atomWithStorage('my-number', 0, withStorageValidator(isNumber)(storage))
})
Expand Down

0 comments on commit 75cabcb

Please sign in to comment.