Can't test redux-zero with JEST and TypeScript?
gerardcsaperas opened this issue · comments
Gerard commented
Hi!
I'm getting the following error message when I try to write unit tests for files that access the redux-zero store (just by importing the files, not even writing tests).
Test suite failed to run
TypeError: (0 , redux_zero_1.default) is not a function
1 | import createStore from 'redux-zero';
2 | /** create redux-zero store */
> 3 | const store = createStore({
| ^
4 | appDimensions: {
5 | width: 0,
6 | height: 0
at Object.<anonymous> (src/data/store.ts:3:15)
at Object.<anonymous> (src/utils/remoteControl.ts:3:1)
Matheus Lima commented
This is how you import it with TypeScript:
import * as createStore from "redux-zero";
It's documented here: https://github.com/redux-zero/redux-zero#how
Gerard commented
Hi @matheusml ,
When I do this:
import * as createStore from 'redux-zero';
/** create redux-zero store */
const store = createStore({
TypeScript's linter gives me the following error message for createStore
:
This expression is not callable.
Type 'typeof import("/Users/<...>/node_modules/redux-zero/index")' has no call signatures.