Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export ReducersEnhancerExt and MiddlewareEnhancerExt interfaces #22

Open
wafflepie opened this issue Mar 15, 2024 · 0 comments
Open

export ReducersEnhancerExt and MiddlewareEnhancerExt interfaces #22

wafflepie opened this issue Mar 15, 2024 · 0 comments

Comments

@wafflepie
Copy link
Owner

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant