onikienko/use-chrome-storage

Typescript error - must have a '[Symbol.iterator]()' method that returns an iterator.

Closed this issue · 2 comments

The following code show this typescript error:

Type '() => [number, Dispatch<SetStateAction>, boolean, string]' must have a 'Symbol.iterator' method that returns an iterator.

 const [value, setValue, isPersistent, error] = useChromeStorageLocal(
    'counterLocal',
    0
  )

If I put a @ts-expect-error before the line, it runs ok, but the values won't be typed.

Thank you for reporting @pauloendoh
The community supports typing. Typescript is not my language.
It will be great if you create PR with a fix.

Hey, guys! @onikienko @pauloendoh

I made this PR to fix it. Can you please review it? #349

I would love to use this library, and this is the only thing missing from me.