From 1d5698843415bcbeaea63f084561ff1d36be5912 Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Tue, 29 Jun 2021 19:58:23 +0900 Subject: [PATCH] Fixed incorrect typing of custom event in standard DOM. --- src/context/script-let.ts | 4 ++++ src/parser/converts/attr.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/context/script-let.ts b/src/context/script-let.ts index d92af7fa..2c5f4c1e 100644 --- a/src/context/script-let.ts +++ b/src/context/script-let.ts @@ -805,6 +805,10 @@ function removeReference(reference: Reference, baseScope: Scope) { /** Remove scope */ function removeScope(scopeManager: ScopeManager, scope: Scope) { + for (const childScope of scope.childScopes) { + removeScope(scopeManager, childScope) + } + while (scope.references[0]) { removeReference(scope.references[0], scope) } diff --git a/src/parser/converts/attr.ts b/src/parser/converts/attr.ts index 5bbc4c4b..94ca51ce 100644 --- a/src/parser/converts/attr.ts +++ b/src/parser/converts/attr.ts @@ -250,7 +250,7 @@ function convertEventHandlerDirective( ctx, isCustomEvent ? "(e:CustomEvent)=>void" - : `(e:HTMLElementEventMap['${node.name}'])=>void`, + : `(e:'${node.name}' extends keyof HTMLElementEventMap?HTMLElementEventMap['${node.name}']:CustomEvent)=>void`, ), ) return directive