Skip to content

Commit 3c3f59e

Browse files
fix(overmind): fix nested partial type of createMock
1 parent b21509b commit 3c3f59e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/node_modules/overmind/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
ResolveState,
1919
Execution,
2020
ResolveMockActions,
21+
NestedPartial,
2122
} from './internalTypes'
2223
import { proxifyEffects } from './proxyfyEffects'
2324
import {
@@ -78,7 +79,7 @@ function deepCopy(obj) {
7879

7980
export function createMock<Config extends Configuration>(
8081
config: Config,
81-
mockedEffects?: Partial<Config['effects']>
82+
mockedEffects?: NestedPartial<Config['effects']>
8283
): {
8384
actions: ResolveMockActions<Config['actions']>
8485
state: ResolveState<Config['state']>

packages/node_modules/overmind/src/internalTypes.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ export type SubType<Base, Condition> = Pick<
66
{ [Key in keyof Base]: Base[Key] extends Condition ? Key : never }[keyof Base]
77
>
88

9+
export type NestedPartial<T> = T extends object
10+
? Partial<{ [P in keyof T]: NestedPartial<T[P]> }>
11+
: T
12+
913
export type Options = {
1014
name?: string
1115
devtools?: string | boolean

0 commit comments

Comments
 (0)