File tree Expand file tree Collapse file tree 3 files changed +17
-7
lines changed
node_modules/overmind-react/src
overmind-website/examples/guide/usingovermindwithreact Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -154,14 +154,24 @@ export const createHook = <Config extends IConfiguration>(
154154 }
155155}
156156
157- export const createConnect = < A extends Overmind < IConfiguration > > (
158- overmindInstance ?: A
157+ export const createConnect = < ThisConfig extends IConfiguration > (
158+ overmindInstance ?: Overmind < ThisConfig >
159159) => {
160160 return < Props > (
161161 component : IReactComponent <
162- Props & { overmind : { state : A [ 'state' ] ; actions : A [ 'actions' ] } }
162+ Props & {
163+ overmind : {
164+ state : Overmind < ThisConfig > [ 'state' ]
165+ actions : Overmind < ThisConfig > [ 'actions' ]
166+ }
167+ }
168+ >
169+ ) : IReactComponent <
170+ Omit <
171+ Props & IConnect < Overmind < ThisConfig > > ,
172+ keyof IConnect < Overmind < ThisConfig > >
163173 >
164- ) : IReactComponent < Omit < Props & IConnect < A > , keyof IConnect < A > > > => {
174+ > => {
165175 let componentInstanceId = 0
166176 const name = component . name
167177 const populatedComponent = component as any
Original file line number Diff line number Diff line change @@ -20,9 +20,9 @@ declare module 'overmind' {
2020
2121export interface Connect extends IConnect<typeof config> {}
2222
23- const overmind = new Overmind(config)
24-
2523export const connect = createConnect(overmind)
24+
25+ const overmind = new Overmind(config)
2626 ` ,
2727 } ,
2828 {
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ declare module 'overmind' {
2020
2121export interface Connect extends IConnect<typeof config> {}
2222
23- export const connect = createConnect()
23+ export const connect = createConnect<typeof config> ()
2424 ` ,
2525 } ,
2626 {
You can’t perform that action at this time.
0 commit comments