The type definitions for this package throw an error:
node_modules/use-reducer-logger/index.d.ts(3,20): error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.
Also, the dispatch type is incorrect. I came up with an example to show case two problems here: TypeScript Playground.
It shows that calling the dispatch function without any argument is not allowed by the type, which is allowed by React. Furthermore, the returned type for dispatch is too loose and does not check the action attributes properly.
I also added a call to useReducer in the example in the README, which I think was missing.
The type definitions for this package throw an error:
Also, the dispatch type is incorrect. I came up with an example to show case two problems here: TypeScript Playground.
It shows that calling the dispatch function without any argument is not allowed by the type, which is allowed by React. Furthermore, the returned type for dispatch is too loose and does not check the action attributes properly.
I also added a call to
useReducer
in the example in the README, which I think was missing.