Skip to content

Commit 193d246

Browse files
fix(overmind): fix typing of addMutationListener
1 parent 2ac34e6 commit 193d246

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/node_modules/overmind-react/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
useState,
1414
useLayoutEffect,
1515
} from 'react'
16+
import { IMutation } from 'proxy-state-tree'
1617

1718
export type IReactComponent<P = any> =
1819
| StatelessComponent<P>
@@ -30,6 +31,7 @@ export type TConnect<Config extends Configuration> = {
3031
overmind: {
3132
state: TApp<Config>['state']
3233
actions: TApp<Config>['actions']
34+
addMutationListener: (cb: (mutation: IMutation) => void) => () => void
3335
}
3436
}
3537

@@ -40,6 +42,7 @@ export const createHook = <A extends Overmind<Configuration>>(
4042
): (() => {
4143
state: A['state']
4244
actions: A['actions']
45+
addMutationListener: (cb: (mutation: IMutation) => void) => () => void
4346
}) => {
4447
let currentComponentInstanceId = 0
4548
const {

packages/node_modules/overmind/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
TTree,
77
IMutation,
88
VALUE,
9+
IMutationCallback,
910
} from 'proxy-state-tree'
1011
import { Derived } from './derived'
1112
import { Devtools, Message, safeValue, safeValues } from './Devtools'
@@ -436,7 +437,7 @@ export class Overmind<Config extends Configuration> implements Configuration {
436437
getMutationTree() {
437438
return this.proxyStateTree.getMutationTree()
438439
}
439-
addMutationListener = (cb) => {
440+
addMutationListener = (cb: IMutationCallback) => {
440441
return this.proxyStateTree.onMutation(cb)
441442
}
442443
}

0 commit comments

Comments
 (0)