[ ] Are you extending internal types to enable type-free syntax with createReducer?
// If yes PASTE HERE your types.d.ts
[x] Did you checked [compatibility notes][1] and [migration guides][2]?
How to Reproduce
CodeSandbox Link
(PASTE HERE your codesandbox link)
No CodeSandbox Link
If no codesandbox, then please provide a full working code example below including actions, reducers and your custom types used in the example.
import test from 'ava';
import * as actions from '~/app/store/auth/auth.actions';
import { store } from '~/app/store';
test('initAuthState', async t => {
await store.dispatch(
actions.initAuthState()
});
Uncaught exception in test/spec/app/store/auth/auth.actions.spec.ts
/node_modules/typesafe-actions/src/utils/validation.ts:79
Error: Argument 1 is invalid, it should be an action-creator instance from "typesafe-actions" or action type of type: string | symbol
throwInvalidActionTypeOrActionCreator (node_modules/typesafe-actions/src/utils/validation.ts:79:9)
map (node_modules/typesafe-actions/src/create-reducer.ts:120:15)
Function.reducerHandler (node_modules/typesafe-actions/src/create-reducer.ts:111:8)
Object.<anonymous> (src/app/store/auth/auth.reducer.ts:2:2138)
Module.m._compile (node_modules/ts-node/src/index.ts:858:23)
module.exports (node_modules/default-require-extensions/js.js:7:9)
Description
Mandatory info
[ ] Are you extending internal types to enable type-free syntax with
createReducer
?[x] Did you checked [compatibility notes][1] and [migration guides][2]?
How to Reproduce
CodeSandbox Link
(PASTE HERE your codesandbox link)
No CodeSandbox Link
If no codesandbox, then please provide a full working code example below including actions, reducers and your custom types used in the example.
Error
Error trace https://github.com/piotrwitek/typesafe-actions/blob/cbed746b3e997942cc93c3b4fa5abb876194ee16/src/utils/validation.ts#L79 https://github.com/piotrwitek/typesafe-actions/blob/master/src/create-reducer.ts#L120
Expected behavior
Production seems to be working just fine, but not sure why the error is thrown when creating the reducer in a test environment.
Suggested solution(s)
An example of how to write tests would be helpful.
Project Dependencies
tsconfig.json: