wafflepie / redux-syringe

💉 Maintaining large Redux applications with ease.
https://redux-syringe.js.org
MIT License
4 stars 2 forks source link

export ReducersEnhancerExt and MiddlewareEnhancerExt interfaces #22

Open wafflepie opened 7 months ago

wafflepie commented 7 months ago

I had to do this in application code to get TS to recognize both store.injectReducers and store.injectMiddleware.

type StoreEnhancerExt<TStoreEnhancer extends StoreEnhancer> =
    TStoreEnhancer extends StoreEnhancer<infer UExt> ? UExt : never;

type ReducersEnhancerExt = StoreEnhancerExt<ReducersEnhancer>;
type MiddlewareEnhancerExt = StoreEnhancerExt<MiddlewareEnhancer>;
type StoreExt = ReducersEnhancerExt & MiddlewareEnhancerExt;

This library should export both ReducersEnhancerExt and MiddlewareEnhancerExt. It would also make sense to rename InjectorStore and relevant types to something else (containing Ext, since that's the proper Redux terminology).