diff --git a/app/javascript/controllers/email_input_controller.ts b/app/javascript/controllers/email_input_controller.ts index 31849ceaa..6a51cc2a2 100644 --- a/app/javascript/controllers/email_input_controller.ts +++ b/app/javascript/controllers/email_input_controller.ts @@ -4,7 +4,7 @@ import { ApplicationController } from './application_controller'; type CheckEmailResponse = | { success: true; - suggestions: string[]; + suggestions?: string[]; } | { success: false }; @@ -38,7 +38,7 @@ export class EmailInputController extends ApplicationController { .catch(() => null); if (data?.success) { - const suggestion = data.suggestions.at(0); + const suggestion = data.suggestions?.at(0); if (suggestion) { this.suggestionTarget.innerHTML = suggestion; show(this.ariaRegionTarget);