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

useObjectState setter types incomplete #325

Open
rmehlinger opened this issue Dec 28, 2024 · 1 comment
Open

useObjectState setter types incomplete #325

rmehlinger opened this issue Dec 28, 2024 · 1 comment

Comments

@rmehlinger
Copy link

useObjectState is typed as follows:
export function useObjectState<T>(initialValue: T): [T, (arg: T) => void];

However, like the basic react state setter hook, the useObjectState setter is also capable of taking a callback as an argument, per the documentation at https://usehooks.com/useobjectstate. This is not supported by the current typing, which should be adjusted to allow it.

@sagarpanchal
Copy link

@rmehlinger

export function useObjectState<T extends Record<PropertyKey, unknown>>(
  initialValue: T
): [T, (arg: T | ((s: T) => T)) => void];

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

2 participants