use-query-string icon indicating copy to clipboard operation
use-query-string copied to clipboard

Typescript / code sandbox example

Open tony opened this issue 3 years ago • 2 comments

Thank you for the project!

I have a bug setting up (typescript 4.3.5, use-query-string 2.4.1, query-string 6.12.0) but think it'd be most efficient if I could give a shot recreating it in a codesandbox to give a reproducible example / isolate it more

TS2488: Type 'QueryStringResult' must have a '[Symbol.iterator]()' method that returns an iterator.
    147 | const HeaderComponent = ({ onPropClicked }: Props) => {
  > 148 |   const [query, setQuery] = useQueryString(window.location, updateQuery)

tony avatar Mar 11 '22 20:03 tony

same

1pone avatar Jun 28 '22 07:06 1pone

I was able to workaround this error via the following:

  import useQueryString, { QueryStringResult } from "use-query-string";

  const [query, setQuery] = useQueryString(window.location, updateQuery) as [
    QueryStringResult[0],
    QueryStringResult[1]
  ];

slaurent22 avatar Aug 19 '23 12:08 slaurent22