Skip to content

Commit 43a8773

Browse files
committed
fix(common): NextStep and selectNext async typing updates
1 parent 4ee53c6 commit 43a8773

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import { AnyObject } from "@data-driven-forms/react-form-renderer";
22

3-
export type NextStep = string | ((values: AnyObject) => string) | AnyObject & {
3+
export type NextStepContext = {
4+
values: AnyObject;
5+
}
6+
7+
export type NextStep = string | ((context: NextStepContext) => string) | ((context: NextStepContext) => Promise<string>) | AnyObject & {
48
stepMapper: {
59
[key: string]: string;
610
[key: number]: string;
711
};
812
when: string[] | string
913
}
1014

11-
declare const selectNext: (nextStep: NextStep, getState: (() => AnyObject & {values: AnyObject})) => string;
15+
declare const selectNext: <T extends NextStep>(nextStep: T, getState: (() => AnyObject & {values: AnyObject})) => T extends (...args: any[]) => infer U ? U : string;
1216
export default selectNext;

0 commit comments

Comments
 (0)