Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension affects value type from sessionStorage #264

Open
smitroshin opened this issue Nov 3, 2023 · 0 comments
Open

Extension affects value type from sessionStorage #264

smitroshin opened this issue Nov 3, 2023 · 0 comments

Comments

@smitroshin
Copy link

What is the current behavior?

image

TypeScript shows me the correct type of useSessionStorage state.
But in reality type is "string".

console.log("🚀 ~ tabId:", tabId, typeof tabId);

# Console output: 🚀 ~ tabId: 1698999742580 string

Demo on CodeSandbox
Test with extension on and off in incognito mode.

Note
Originally, the issue was written for react-use library.
But after, I found out that json-formatter makes that happened.

What is the expected behavior?

Type of useSessionStorage state should have type inherited from initialValue.

A little about versions:

  • OS: Windows 10 x64
  • Browser (vendor and version): Chrome Version 119.0.6045.106 (Official Build) (64-bit)
  • React: ^17.0.2
  • TypeScript: ^4.4.2
  • react-scripts: 5.0.0
  • react-use: ^17.4.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant