Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"version": "0.3.0",
"description": "A custom React Hook that provides a multi-instance, multi-tab/browser shared and persistent state.",
"main": "dist/use-persisted-state.js",
"types": "use-persisted-state.d.ts",
"umd:main": "dist/use-persisted-state.umd.js",
"module": "dist/use-persisted-state.m.js",
"source": "src/index.js",
Expand Down
4 changes: 4 additions & 0 deletions use-persisted-state.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module 'use-persisted-state' {
function createPersistedState<T>(key: string, storage: Storage): (initialState: T) => [S, Dispatch<SetStateAction<S>>];
Comment on lines +1 to +2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to make storage optional via storage?: Storage, since it has a default

export = createPersistedState;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is the default export, I had to use export default createPersistedState. Without that, it would work fine, but TS was complaining about synthetic default imports

}