You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When using Eventrix, we need to manually specify the return type of each useEventrixState hook. This can lead to potential type mismatches between the store and state types, especially when dealing with complex store structures.
Describe the solution you'd like
I propose that the types for useEventrixState be automatically inferred based on the Eventrix store type. This would simplify usage and reduce the potential for type errors.
In this case, the type of the tasks variable should be automatically inferred as Task[].
Additionally, the type inference should also work for nested states. When using useEventrixState with a path like 'test.example', the type should be inferred as string.
Additional context
A similar feature exists in the React Hook Form library, where the types for form values and errors are automatically inferred based on the form schema.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
When using Eventrix, we need to manually specify the return type of each
useEventrixState
hook. This can lead to potential type mismatches between the store and state types, especially when dealing with complex store structures.Describe the solution you'd like
I propose that the types for
useEventrixState
be automatically inferred based on the Eventrix store type. This would simplify usage and reduce the potential for type errors.For instance, consider the following example:
In this case, the type of the
tasks
variable should be automatically inferred asTask[]
.Additionally, the type inference should also work for nested states. When using
useEventrixState
with a path like'test.example'
, the type should be inferred as string.Additional context
A similar feature exists in the React Hook Form library, where the types for form values and errors are automatically inferred based on the form schema.
The text was updated successfully, but these errors were encountered: