diff --git a/lib/internal/event_target.js b/lib/internal/event_target.js index 763542eb0fc2fa..611aa9922118a1 100644 --- a/lib/internal/event_target.js +++ b/lib/internal/event_target.js @@ -50,7 +50,7 @@ class Event { this.#cancelable = !!cancelable; this.#bubbles = !!bubbles; this.#composed = !!composed; - this.#type = String(type); + this.#type = `${type}`; // isTrusted is special (LegacyUnforgeable) Object.defineProperty(this, 'isTrusted', { get() { return false; }, diff --git a/test/parallel/test-eventtarget.js b/test/parallel/test-eventtarget.js index 99d717abda6e8d..1b79a6bbb0ffd6 100644 --- a/test/parallel/test-eventtarget.js +++ b/test/parallel/test-eventtarget.js @@ -49,6 +49,7 @@ ok(EventTarget); ev.preventDefault(); strictEqual(ev.defaultPrevented, true); + throws(() => new Event(Symbol()), TypeError); } { const ev = new Event('foo');