Skip to content

Commit 9f61bf0

Browse files
authored
Fixed incorrect typing of custom event in standard DOM. (#60)
1 parent 71286d9 commit 9f61bf0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/context/script-let.ts

+4
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,10 @@ function removeReference(reference: Reference, baseScope: Scope) {
805805

806806
/** Remove scope */
807807
function removeScope(scopeManager: ScopeManager, scope: Scope) {
808+
for (const childScope of scope.childScopes) {
809+
removeScope(scopeManager, childScope)
810+
}
811+
808812
while (scope.references[0]) {
809813
removeReference(scope.references[0], scope)
810814
}

src/parser/converts/attr.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ function convertEventHandlerDirective(
250250
ctx,
251251
isCustomEvent
252252
? "(e:CustomEvent<any>)=>void"
253-
: `(e:HTMLElementEventMap['${node.name}'])=>void`,
253+
: `(e:'${node.name}' extends keyof HTMLElementEventMap?HTMLElementEventMap['${node.name}']:CustomEvent<any>)=>void`,
254254
),
255255
)
256256
return directive

0 commit comments

Comments
 (0)