export type SubmitError = 'submitError' export type ValidationErrors = 'validationErrors' export type SubmitNotificationType = SubmitError | 'submitSuccess' export type NotificationType = ValidationErrors | SubmitNotificationType export type Reason = S extends SubmitError ? string : S extends ValidationErrors ? Array : undefined export type NotifyCallback = ( /** Type of notification */ type: S, /** * If type is `submitError` * you can pass a reason for why submitting failed. * * If it is `validationErrors`, * the reason will be a list of fields that * did not pass their validation. * */ reason?: Reason ) => void