Non of the plugins from reactotron-react-native are exported in the typescript types
I'm still unclear on how to extend typescript types with additional features from multiple plugins.
I think we're going to have to do a DIY union. I just don't know of another way.
Is there any update on this? We want to use reactotron-redux and reactotron-redux-saga with our React Native app written in typescript.
You can click the subscribe button to the right to track if there's any updates to this.
I created typings to get it to work with my project. Here they are below (they're incomplete for the whole library because these were the only functions we needed typed). This would be the typing for reactotron-redux
import Reactotron, {ReactotronPlugin} from 'reactotron-react-native';
import {StoreCreator} from 'redux';
// Module Augmentation for plugin
declare module 'reactotron-react-native' {
export interface Reactotron {
createStore: StoreCreator;
}
}
declare module 'reactotron-redux' {
export function reactotronRedux(): (reactotron: Reactotron) => ReactotronPlugin;
}
Hey guys, just fixed a small issue with the type definition in #748. I got no idea why the compiler didn't give you a warning before for close() but not a big issue.
Over the next few days will try to get some of the plugins to work
Hi guys, to continue to extend the typescript definition. Here I included another bit of the definition: #757
Hi @ajmotika, are you going to create a pull request with your type definitions? I am adding these little by little and got to the point you might want to contribute? otherwise, I can create the pull request and push it up for review.
Thanks @rodrigoelp! if you have the PR ready to go then you can push it up for review. If not, I can relook at everything and get one up tomorrow.
Hi @ajmotika, I did create a branch for it and just amended it to include a mention to your contribution (if you are happy with that). Ironically, somebody had created the typedef for redux but it was not linked to the package.json file so the type was never discoverable to typescript. I am just waiting for the approval of my PR to chuck this one in.
Alternatively, you can provide comments to the branch as I have pushed it up here: redux branch
It includes the redux and redux-saga typedef.
Apparently, somebody pushed the redux typedef before I created the pull request, not a big issue, added the redux-saga typedef here #764
I'll cut a 2.1 build this week. I've got some more typedefs to include as well on reactotron-react-native.
Thanks for everyone's help! Really appreciate it!
Hi guys, has this been resolved yet? I'm still getting TS2339: Property 'createStore' does not exist on type 'Reactotron'.
Hey @rclai!
I have seen this issue popup as a one off that usually was related to the order code was executed (for example the Reactotron config not running until after you create, or attempt to create, your redux store).
That said I am working on what is basically a rewrite of the reactotorn-redux library that removes the need for using a createStore off of Reactotron 馃帀 I am in the final phases of the rewrite so it should hopefully be available soon!
There is no runtime issue, it's just that typescript is complaining to me.
Oh, sorry. Guess I shouldn't have read so quickly. In that case with the rewrite I plan on hardening up the types as much as I can. I would suggest doing something like (reactotron as any).createStore for now.
Ah okay thanks.
Any idea why this issue was closed?
Most helpful comment
Oh, sorry. Guess I shouldn't have read so quickly. In that case with the rewrite I plan on hardening up the types as much as I can. I would suggest doing something like
(reactotron as any).createStorefor now.