Skip to content

Commit b7214e6

Browse files
fix(action-chain): extend void instead of undefined due to weirdness
1 parent 3add187 commit b7214e6

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

packages/node_modules/action-chain/src/ActionBase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function actionBaseFactory<
2626
Context,
2727
InitialValue,
2828
Value = InitialValue,
29-
ReturnAction = InitialValue extends undefined
29+
ReturnAction = InitialValue extends void
3030
? NoValueActionBase<Context, InitialValue, Value>
3131
: ActionBase<Context, InitialValue, Value>
3232
>(

packages/node_modules/overmind-devtools/src/client/app/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default (action: Action) => {
2424
.mutation(mutations.addNewApp)
2525
.mutation(mutations.resetNewPortValue)
2626
.do(helpers.storeApps),
27-
changeTab: action().mutation((value: string) => {}),
27+
changeTab: action<Tab>().mutation(mutations.changeTab),
2828
openApp: action<string>(),
2929
}
3030
}

packages/node_modules/overmind/src/createActionFactory.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ type OperatorCallback<Context, Value, NewValue = Value> = (
1515
interface Operators<State, Context, InitialValue, Value> {
1616
mutation(
1717
cb: (value: Value, state: State) => any
18-
): InitialValue extends undefined
18+
): InitialValue extends void
1919
? NoValueAction<State, Context, InitialValue, Value>
2020
: Action<State, Context, InitialValue, Value>
2121
do(
2222
cb: (value: Value, context: Context) => void
23-
): InitialValue extends undefined
23+
): InitialValue extends void
2424
? NoValueAction<State, Context, InitialValue, Value>
2525
: Action<State, Context, InitialValue, Value>
2626
map<NewValue>(
2727
cb: (value: Value, context: Context) => NewValue | Promise<NewValue>
28-
): InitialValue extends undefined
28+
): InitialValue extends void
2929
? NoValueAction<State, Context, InitialValue, NewValue>
3030
: Action<State, Context, InitialValue, NewValue>
3131
try<ResolveValue, RejectValue, NewValue>(
@@ -44,7 +44,7 @@ interface Operators<State, Context, InitialValue, Value> {
4444
RejectValue
4545
>
4646
}
47-
): InitialValue extends undefined
47+
): InitialValue extends void
4848
? NoValueAction<State, Context, InitialValue, ResolveValue | RejectValue>
4949
: Action<State, Context, InitialValue, ResolveValue | RejectValue>
5050
when<TrueValue, FalseValue>(
@@ -53,17 +53,17 @@ interface Operators<State, Context, InitialValue, Value> {
5353
true: Action<State, Context, Value, TrueValue>
5454
false: Action<State, Context, Value, FalseValue>
5555
}
56-
): InitialValue extends undefined
56+
): InitialValue extends void
5757
? NoValueAction<State, Context, InitialValue, TrueValue | FalseValue>
5858
: Action<State, Context, InitialValue, TrueValue | FalseValue>
5959
filter(
6060
cb: (value: Value, context: Context) => boolean
61-
): InitialValue extends undefined
61+
): InitialValue extends void
6262
? NoValueAction<State, Context, InitialValue, Value>
6363
: Action<State, Context, InitialValue, Value>
6464
debounce(
6565
timer: number
66-
): InitialValue extends undefined
66+
): InitialValue extends void
6767
? NoValueAction<State, Context, InitialValue, Value>
6868
: Action<State, Context, InitialValue, Value>
6969
}
@@ -89,7 +89,7 @@ export default function createActionFactory<State, Context>(proxyStateTree) {
8989
value: any,
9090
executionContext: ExecutionContext
9191
) => any | Promise<any>
92-
): InitialValue extends undefined
92+
): InitialValue extends void
9393
? NoValueAction<State, Context, InitialValue, Value>
9494
: Action<State, Context, InitialValue, Value> {
9595
return Object.assign(

packages/node_modules/overmind/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export type TContext<State, Providers = {}> = Providers & {
2626
}
2727

2828
export interface IAction<State, Context> {
29-
<InitialValue = undefined>(): InitialValue extends undefined
29+
<InitialValue = void>(): InitialValue extends void
3030
? NoValueAction<State, Context, InitialValue>
3131
: Action<State, Context, InitialValue>
3232
}
@@ -70,7 +70,7 @@ export default class App<
7070
State,
7171
Providers & { state: State }
7272
>(proxyStateTree)
73-
const action = function<InitialValue>(): InitialValue extends undefined
73+
const action = function<InitialValue>(): InitialValue extends void
7474
? NoValueAction<State, Providers & { state: State }, InitialValue>
7575
: Action<State, Providers & { state: State }, InitialValue> {
7676
return actionFactory<InitialValue>(actionChain)

0 commit comments

Comments
 (0)