esamattis / esamattis/immer-reducer

Export ActionCreators type to allow re-exporting generated actionCreators

Open
#42 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
223
Forks
15
PR merge metrics
No merged PRs in 30d

Description

I'm creating a library to allow shimming my redux store with test data, but while keeping the interfaces/actions generated by immer-reducer, combined with TS project references.

I use the compiler switch "declarations" so we generate .d.ts files, however with this switch we get compiler errors on our exported reducer functions

`export const uploadReducer = createReducerFunction(UploadReducer, initialState);`

Exported variable 'A' has or is using name 'ImmerReducerFunction' from external module ".../immer-reducer/lib/immer-reducer" but cannot be named.

From googling, it appears that because this type isn't exported from immer-reducer, TS seems to not be able to generate the .d.ts files describing it.

Current workaround is to set reducers to type "any", which isn't a big deal but sub-optimal

`export const uploadReducer: any = createReducerFunction(UploadReducer, initialState);`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.