fix(stimulus): on handler having target

This commit is contained in:
Colin Darie 2023-01-30 11:00:17 +01:00
parent 2aa6e635f1
commit ec1ae25bb4

View file

@ -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);
}