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
We generally consider some types are internal, and don't export many types.
In the case of Store, we didn't even have it internally either.
I believe ReturnType<typeof createStore> is the right solution, not just a workaround, unless there's drawback. (I don't think I get "slow types" with JSR #2443, so it should be fine.)
Hmm @dai-shi I'm not sure I fully understand. All return types on public functions are already part of the public API. By not exposing them, you put users in a weird spot where they cannot use the types they're already consuming in one way or another.
While it's true that you can do ReturnType<typeof createStore>, this really is a gigantic hack and a quirk of TypeScript's turing-complete type system. I don't think any non gradually typed programming languages would let you get away with returning a non-public type.
Summary
Jotai doesn't export the
Store
type forcreateStore
Link to reproduction
Workaround
Question
Is there a reason why it's not exported?
The text was updated successfully, but these errors were encountered: