Skip to content

Commit dd1143e

Browse files
fix(overmind): fix typing of forEach and fork
1 parent 049ea20 commit dd1143e

File tree

1 file changed

+10
-10
lines changed
  • packages/node_modules/overmind/src

1 file changed

+10
-10
lines changed

packages/node_modules/overmind/src/index.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -778,33 +778,33 @@ export type Operator<Input = void, Output = Input> = IOperator<
778778

779779
export function pipe<ThisConfig extends IConfiguration, A, B>(
780780
aOperator: IOperator<ThisConfig, A, B>
781-
): IOperator<ThisConfig, A, B>
781+
): IOperator<ThisConfig, A, B extends never ? any : B>
782782

783783
export function pipe<ThisConfig extends IConfiguration, A, B, C>(
784784
aOperator: IOperator<ThisConfig, A, B>,
785785
bOperator: IOperator<ThisConfig, B, C>
786-
): IOperator<ThisConfig, A, C>
786+
): IOperator<ThisConfig, A, C extends never ? any : C>
787787

788788
export function pipe<ThisConfig extends IConfiguration, A, B, C, D>(
789789
aOperator: IOperator<ThisConfig, A, B>,
790790
bOperator: IOperator<ThisConfig, B, C>,
791791
cOperator: IOperator<ThisConfig, C, D>
792-
): IOperator<ThisConfig, A, D>
792+
): IOperator<ThisConfig, A, D extends never ? any : D>
793793

794794
export function pipe<ThisConfig extends IConfiguration, A, B, C, D, E>(
795795
aOperator: IOperator<ThisConfig, A, B>,
796796
bOperator: IOperator<ThisConfig, B, C>,
797797
cOperator: IOperator<ThisConfig, C, D>,
798798
dOperator: IOperator<ThisConfig, D, E>
799-
): IOperator<ThisConfig, A, E>
799+
): IOperator<ThisConfig, A, E extends never ? any : E>
800800

801801
export function pipe<ThisConfig extends IConfiguration, A, B, C, D, E, F>(
802802
aOperator: IOperator<ThisConfig, A, B>,
803803
bOperator: IOperator<ThisConfig, B, C>,
804804
cOperator: IOperator<ThisConfig, C, D>,
805805
dOperator: IOperator<ThisConfig, D, E>,
806806
eOperator: IOperator<ThisConfig, E, F>
807-
): IOperator<ThisConfig, A, F>
807+
): IOperator<ThisConfig, A, F extends never ? any : F>
808808

809809
export function pipe<ThisConfig extends IConfiguration, A, B, C, D, E, F, G>(
810810
aOperator: IOperator<ThisConfig, A, B>,
@@ -813,7 +813,7 @@ export function pipe<ThisConfig extends IConfiguration, A, B, C, D, E, F, G>(
813813
dOperator: IOperator<ThisConfig, D, E>,
814814
eOperator: IOperator<ThisConfig, E, F>,
815815
fOperator: IOperator<ThisConfig, F, G>
816-
): IOperator<ThisConfig, A, G>
816+
): IOperator<ThisConfig, A, G extends never ? any : G>
817817

818818
export function pipe(...operators) {
819819
const instance = (err, context, next, final = next) => {
@@ -987,7 +987,10 @@ export function forEach<
987987
Input extends any[],
988988
ThisConfig extends IConfiguration = Config
989989
>(
990-
forEachItemOperator: IOperator<ThisConfig, Input[0], any>
990+
forEachItemOperator: IOperator<
991+
ThisConfig,
992+
Input extends Array<infer U> ? U : never
993+
>
991994
): IOperator<ThisConfig, Input, Input> {
992995
const instance = (err, context, next) => {
993996
if (err) next(err)
@@ -1172,9 +1175,6 @@ export function action<Input, ThisConfig extends IConfiguration = Config>(
11721175

11731176
export function fork<
11741177
Input,
1175-
// The Output should not really be ANY here, as it will type the last operator
1176-
// input as ANY, but no way to infer this either... so either force to same as Input
1177-
// or last will be ANY
11781178
Paths extends { [key: string]: IOperator<ThisConfig, Input, any> },
11791179
ThisConfig extends IConfiguration = Config
11801180
>(

0 commit comments

Comments
 (0)