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
{{ message }}
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.
When I tried to type my global state inside my setGlobal(), when I retrieve my field with useGlobal() I lost the typing, ts say me my variable is of type 'any'.
The text was updated successfully, but these errors were encountered:
This is correct, unfortunately. There's no way for it to know. If you change the shape of the global state in another file, useGlobal can't know that or the new shape in order to tell you the type it is returning.
You can use useGlobal<Type>('property') to tell it the type.
I'm working on a complete rewrite of ReactN in TypeScript that should improve upon this system.. While types can't be inferred by useGlobal, they'll at least we inferred by Provider and supported by more helper functions than present.
When I tried to type my global state inside my setGlobal(), when I retrieve my field with useGlobal() I lost the typing, ts say me my variable is of type 'any'.
The text was updated successfully, but these errors were encountered: