From ec1ae25bb4b5671ba4edb253f18c4a601a75fda0 Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Mon, 30 Jan 2023 11:00:17 +0100 Subject: [PATCH] fix(stimulus): on handler having target --- app/javascript/controllers/application_controller.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/javascript/controllers/application_controller.ts b/app/javascript/controllers/application_controller.ts index 4070dbb03..ada9f6a78 100644 --- a/app/javascript/controllers/application_controller.ts +++ b/app/javascript/controllers/application_controller.ts @@ -65,7 +65,10 @@ export class ApplicationController extends Controller { FOCUS_EVENTS.includes(targetOrEventName) ); } else { - invariant(eventNameOrHandler == 'string', 'event name is required'); + invariant( + typeof eventNameOrHandler == 'string', + 'event name is required' + ); invariant(handler, 'handler is required'); this.onTarget(targetOrEventName, eventNameOrHandler, handler); }