reactotron: Add missing types

Non of the plugins from reactotron-react-native are exported in the typescript types

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 8
  • Comments: 17 (8 by maintainers)

Commits related to this issue

Most upvoted comments

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.

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!

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;
}

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.