diff --git a/packages/common/src/wizard/select-next.d.ts b/packages/common/src/wizard/select-next.d.ts index 3bc0316f3..16e66d333 100644 --- a/packages/common/src/wizard/select-next.d.ts +++ b/packages/common/src/wizard/select-next.d.ts @@ -1,6 +1,10 @@ import { AnyObject } from "@data-driven-forms/react-form-renderer"; -export type NextStep = string | ((values: AnyObject) => string) | AnyObject & { +export type NextStepContext = { + values: AnyObject; +} + +export type NextStep = string | ((context: NextStepContext) => string) | ((context: NextStepContext) => Promise) | AnyObject & { stepMapper: { [key: string]: string; [key: number]: string; @@ -8,5 +12,5 @@ export type NextStep = string | ((values: AnyObject) => string) | AnyObject & { when: string[] | string } -declare const selectNext: (nextStep: NextStep, getState: (() => AnyObject & {values: AnyObject})) => string; +declare const selectNext: (nextStep: T, getState: (() => AnyObject & {values: AnyObject})) => T extends (...args: any[]) => infer U ? U : string; export default selectNext;