#array destructuring - wrong types

2 messages · Page 1 of 1 (latest)

gilded impBOT
#
piscopancer#0

Preview:```ts
// declaration of hook
export default function useSearchParams(route: string) {
function set(key: string, value: string) {
//
}
function unset(key: string) {
//
}
return [set, unset]
}

//making it universal for blog page components
export const useBlogSearchParams = () => useSearchParams('/blog')

//using it (bug: hover over functions and notice their types corresond to "set" function)
const [setBlogSP, unsetBlogSP] = useBlogSearchParams()
...```

still hare
#
return [set, unset] as const

fixed it