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

Support generic type parameter for useStateObject to enable type-safe access #5

Open
kaitok opened this issue Mar 27, 2025 · 0 comments

Comments

@kaitok
Copy link

kaitok commented Mar 27, 2025

Feature Request: Add generic type support to useStateObject

Currently, useStateObject returns a value typed as SerializableObject, which does not provide type safety or IntelliSense when accessing deeply nested properties.

const [queryData, setQueryData] = useStateObject({
  name: "queryData"
});

// Currently: queryData is SerializableObject → no type safety
console.log(queryData.items); // ❌ no autocomplete or type checking

It would be very helpful if useStateObject could support a generic type parameter, as in:

const [queryData, setQueryData] = useStateObject<QueryDataResult>({
  name: "queryData"
});

Thanks for considering this enhancement!

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

1 participant