PromptValidator type

Function signature for providing a custom prompt validator.

type PromptValidator<T> = (prompt: PromptValidatorContext<T>) => Promise<boolean>;
type PromptValidator<T> = (
  prompt: PromptValidatorContext<T>
) => Promise<boolean>

Remarks

The validator should be an asynchronous function that returns true if prompt.recognized.value is valid and the prompt should end.

Note

If the validator returns false the prompts default re-prompt logic will be run unless the validator sends a custom re-prompt to the user using prompt.context.sendActivity(). In that case the prompts default re-rpompt logic will not be run.