Skip to content

Commit 310a0c4

Browse files
fix(overmind-react): fix typing
1 parent 282b5dc commit 310a0c4

File tree

1 file changed

+28
-28
lines changed
  • packages/node_modules/overmind-react/src

1 file changed

+28
-28
lines changed

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

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -194,62 +194,62 @@ const useReaction = <Config extends IConfiguration>(): Overmind<Config>['reacti
194194
return overmind.reaction
195195
}
196196

197-
export const createStateHook = <Config extends IConfiguration>(): Overmind<Config>['state'] => {
197+
export const createStateHook: <Config extends IConfiguration>() => () => Overmind<Config>['state'] = () => {
198198
return useState as any
199199
}
200200

201-
export const createActionsHook = <Config extends IConfiguration>(): Overmind<Config>['actions'] => {
201+
export const createActionsHook: <Config extends IConfiguration>() => () => Overmind<Config>['actions'] = ()=> {
202202
return useActions as any
203203
}
204204

205-
export const createEffectsHook = <Config extends IConfiguration>(): Overmind<Config>['effects'] => {
205+
export const createEffectsHook: <Config extends IConfiguration>() => () => Overmind<Config>['effects'] = () => {
206206
return useEffects as any
207207
}
208208

209-
export const createReactionHook = <Config extends IConfiguration>(): Overmind<Config>['reaction'] => {
209+
export const createReactionHook: <Config extends IConfiguration>() => () => Overmind<Config>['reaction'] = () => {
210210
return useReaction as any
211211
}
212212

213-
export const createHook = <Config extends IConfiguration>(): (() => {
213+
export const createHook: <Config extends IConfiguration>() => () => {
214214
state: Overmind<Config>['state']
215215
actions: Overmind<Config>['actions']
216216
effects: Overmind<Config>['effects']
217217
addMutationListener: (cb: IMutationCallback) => () => void
218218
reaction: Overmind<Config>['reaction']
219-
}) => {
219+
} = () => {
220220
return () => {
221-
const state = useState<Config>()
222-
const actions = useActions<Config>()
223-
const effects = useEffects<Config>()
224-
const overmind = react.useContext(context) as Overmind<Config>
221+
const state = useState()
222+
const actions = useActions()
223+
const effects = useEffects()
224+
const overmind = react.useContext(context)
225225

226226
return {
227227
state,
228228
actions,
229229
effects,
230230
reaction: overmind.reaction,
231231
addMutationListener: overmind.addMutationListener
232-
}
232+
} as any
233233
}
234234
}
235235

236-
export const createConnect = <ThisConfig extends IConfiguration>() => {
237-
return <Props>(
238-
component: IReactComponent<
239-
Props & {
240-
overmind: {
241-
state: Overmind<ThisConfig>['state']
242-
actions: Overmind<ThisConfig>['actions']
243-
reaction: Overmind<ThisConfig>['reaction']
244-
}
245-
}
246-
>
247-
): IReactComponent<
248-
Omit<
249-
Props & IConnect<Overmind<ThisConfig>>,
250-
keyof IConnect<Overmind<ThisConfig>>
251-
>
252-
> => {
236+
export const createConnect: <ThisConfig extends IConfiguration>() => <Props>(component: IReactComponent<
237+
Props & {
238+
overmind: {
239+
state: Overmind<ThisConfig>['state']
240+
actions: Overmind<ThisConfig>['actions']
241+
reaction: Overmind<ThisConfig>['reaction']
242+
}
243+
}
244+
>) => IReactComponent<
245+
Omit<
246+
Props & IConnect<Overmind<ThisConfig>>,
247+
keyof IConnect<Overmind<ThisConfig>>
248+
>
249+
> = () => {
250+
return (
251+
component
252+
)=> {
253253
let componentInstanceId = 0
254254
const name = component.name
255255
const populatedComponent = component as any

0 commit comments

Comments
 (0)