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

Upgrading from 1.4 to 2.0 gives my localstorage.get syntax error with TypeScript #29

Open
pkellner opened this issue May 31, 2020 · 1 comment

Comments

@pkellner
Copy link

Sorry for not understanding better how to post, but had a working project that just did these two lines:

import ls from 'local-storage';
const user = ls.get('userInfo');

When I upgraded to 2.0, I started getting TypeScrpt error complaining about get.

The error is as follows:

Property 'get' does not exist on type '<T>(key: string, value?: T | undefined) => void'.

If this issue makes no sense, feel free to close. I really don't understand why I'd get an error like that.

@sunnyguan
Copy link

sunnyguan commented Mar 24, 2021

Change your import statement to:

import * as ls from "local-storage"

See https://github.com/bevacqua/local-storage#typescript

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

2 participants