Skip to content

Commit

Permalink
fix(createUseStorageState): fix type of returned undefined value
Browse files Browse the repository at this point in the history
  • Loading branch information
y-temp4 committed Sep 12, 2023
1 parent 5412bb7 commit c3c3dc0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/hooks/src/createUseStorageState/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ export interface Options<T> {
}

export function createUseStorageState(getStorage: () => Storage | undefined) {
function useStorageState<T>(
key: string,
options: Options<T> & { defaultValue: T | (() => T) },
): [T, (value?: SetState<T>) => void];
function useStorageState<T>(
key: string,
options?: Options<T>,
): [T | undefined, (value?: SetState<T>) => void];
function useStorageState<T>(key: string, options: Options<T> = {}) {
let storage: Storage | undefined;
const {
Expand Down

0 comments on commit c3c3dc0

Please sign in to comment.