Persist middleware causing typescript error with boolean values #2231
Unanswered
johnslemmer
asked this question in
Bug report
Replies: 1 comment 1 reply
-
|
TS Playground: https://tsplay.dev/Wo1O8N I don't think there's anything we can do. Would anyone like to create a reproduction without Zustand and report it to https://github.com/microsoft/TypeScript/issues? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
This is certainly related to #2068 and #2163 which point to the merged PR #2170 suggesting that this should be fixed. But it isn't. There was also some mention of
tsconfig.moduleResolutionbeing set tobundlercausing issues. But both on my linked codesandbox and my local project that is not the case. So I'm starting a new discussion.Here is an example of the code that errors. This seems unexpected.
Error being generated:
Type 'boolean' is not assignable to type 'false'.ts(2345)Certainly there is a workaround:
loading: false as booleanbut that seems like that shouldn't be needed. And per the documentation "You do not have to do anything special to use middlewares in TypeScript."Tried this on versions 4.3.9, 4.4.6, 4.4.7. Typescript 5.3.2 and 5.3.3. Node 20.10.0.
Any ideas?
Link to reproduction
https://codesandbox.io/s/romantic-williamson-3hz8vl
(try the old editor on codesandbox, the new editor is being real buggy today)
Beta Was this translation helpful? Give feedback.
All reactions