Skip to content

Commit ff53e7a

Browse files
authored
Merge pull request infinitered#558 from infinitered/fix-typings
🐛 Adds missing TS types for onCommand
2 parents 696665d + 466a6ea commit ff53e7a

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

packages/reactotron-react-native/reactotron-react-native.d.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,35 @@ declare module 'reactotron-react-native' {
4747
overlay?: false
4848
}
4949

50+
export interface ReactotronCommand {
51+
/**
52+
* The type of command.
53+
*/
54+
type: string
55+
/**
56+
* The data belonging to the command.
57+
*/
58+
payload: any
59+
}
60+
61+
export interface ReactotronPlugin {
62+
features: any
63+
/**
64+
* Fires when a command from the reactotron app arrives.
65+
*/
66+
onCommand: (command: ReactotronCommand) => void
67+
/**
68+
* Fires when connecting to the reactotron app.
69+
*/
70+
onConnect: () => void
71+
/**
72+
* Fires when disconnected from the reactotron app.
73+
*/
74+
onDisconnect: () => void
75+
}
76+
77+
// export type ReactotronUseMiddleware = (tron?: Reactotron) => ReactotronMiddleware
78+
5079
/**
5180
* Reactotron.
5281
*/
@@ -66,6 +95,11 @@ declare module 'reactotron-react-native' {
6695
*/
6796
useReactNative(options?: ReactotronUseReactNativeOptions): Reactotron
6897

98+
/**
99+
* Uses some generic middleware.
100+
*/
101+
use(middleware: (tron: Reactotron) => void): Reactotron
102+
69103
/**
70104
* Clears the Reactotron app.
71105
*/

0 commit comments

Comments
 (0)