Typescript compatibility issue with redux 4.0.4 and webext-redux types
ymdevs opened this issue · 1 comments
ymdevs commented
When using typescript with redux and webext-redux, there is a mismatch between their Store types.
in the webext-redux Store definition:
class Store<S = any, A extends redux.Action = redux.AnyAction>
webext-redux is missing the following object definition
[Symbol.observable](): Observable<S>
which includes a few sub-definitions.
Example of the error I am getting
(JSX attribute) store: Store<any, AnyAction>
The single Redux store in your application.
No overload matches this call.
Overload 1 of 2, '(props: Readonly<ProviderProps<AnyAction>>): Provider<AnyAction>', gave the following error.
Property '[Symbol.observable]' is missing in type 'import("~/TestProject/node_modules/webext-redux/index").Store<any, import("~/TestProject/node_modules/redux/index").AnyAction>' but required in type 'import("~/TestProject/node_modules/redux/index").Store<any, import("~/TestProject/node_modules/redux/index").AnyAction>'.
Overload 2 of 2, '(props: ProviderProps<AnyAction>, context?: any): Provider<AnyAction>', gave the following error.
Type 'import("~/TestProject/node_modules/webext-redux/index").Store<any, import("~/TestProject/node_modules/redux/index").AnyAction>' is not assignable to type 'import("~/TestProject/node_modules/redux/index").Store<any, import("~/TestProject/node_modules/redux/index").AnyAction>'.ts(2769)
index.d.ts(247, 3): '[Symbol.observable]' is declared here.
index.d.ts(446, 5): The expected type comes from property 'store' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Provider<AnyAction>> & Readonly<ProviderProps<AnyAction>> & Readonly<{ children?: ReactNode; }>'
index.d.ts(446, 5): The expected type comes from property 'store' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Provider<AnyAction>> & Readonly<ProviderProps<AnyAction>> & Readonly<{ children?: ReactNode; }>'
Peek Problem
No quick fixes available
When I manually added the missing types the error disappeared.
Suggesting to update the types file, or I can write it and send a pull request.
Thanks,