Any plans for creating typescript definitions? Also, is rxjs5 on the roadmap?
adrian-moisa opened this issue · 0 comments
adrian-moisa commented
Are there any types available for redux-rx? I tried npm install @types/redux-rx
and looks like there are none. Eventually I tried the following:
tsconfig.json
"typeRoots": [
"./node_modules/@types",
"./public/shared/types"
]
index.d.ts
declare module 'redux-rx';
Eventually i got this error. After some digging on the web I understand that rx is v4 and rxjs is v5
ERROR in ./node_modules/redux-rx/lib/observableFromStore.js
Module not found: Error: Can't resolve 'rx' in '....\node_modules\redux-rx\lib'
@ ./node_modules/redux-rx/lib/observableFromStore.js 6:10-23
@ ./node_modules/redux-rx/lib/index.js
@ ./public/main.ts
@ multi (webpack)-dev-server/client?http://localhost:8081 ./public/main.ts
Considering that all I need is the following, I'll just write it myself in a service.
function observableFromStore(store) {
return _rx.Observable.create(function (observer) {
return store.subscribe(function () {
return observer.onNext(store.getState());
});
});
}
Updated
function observableFromStore(store: Store<AppState>) {
return Observable.create((observer: any) => {
return store.subscribe(() => {
return observer.next(store.getState());
});
});
}