rt2zz / redux-persist

persist and rehydrate a redux store
MIT License
12.94k stars 866 forks source link

TypeScript types of "substate" and "raw state" are mixed up. #1305

Closed futpib closed 3 years ago

futpib commented 3 years ago

Looking at this, I figure that S is the type of a persisted subset of a redux state and RS is the type of a complete redux state: https://github.com/rt2zz/redux-persist/blob/d7efde9115a0bd2d6a0309ac6fb1c018bf06dc30/types/types.d.ts#L94-L100

Here S again refers to a persisted substate: https://github.com/rt2zz/redux-persist/blob/d7efde9115a0bd2d6a0309ac6fb1c018bf06dc30/types/types.d.ts#L26

But in the type of persistReducer S is used as a persisted substate in PersistConfig<S> but at the same time as a raw state in baseReducer: Reducer<S, A> and in the return type. https://github.com/rt2zz/redux-persist/blob/d7efde9115a0bd2d6a0309ac6fb1c018bf06dc30/types/persistReducer.d.ts#L15