-
Notifications
You must be signed in to change notification settings - Fork 582
Open
Description
Hi, I used the useDefault hook in my project with typescript in strict mode and had a little issue with the types returned by useDefault.
If I write the following code
import { useDefault } from "@uidotdev/usehooks";
function getInitialFoo(): string | null {
return null;
}
export function App() {
const initalFoo = getInitialFoo();
const [foo, setFoo] = useDefault(initalFoo, "default");
}
then foo is string | null.
I would expect foo to be string since the passed default value is a string. So I was wondering if the types for useDefault are correct? Or am I missing something?
minecrawler
Metadata
Metadata
Assignees
Labels
No labels
