Skip to content

Commit c10531c

Browse files
committed
Do not emit the global string addEventListener overload twice
1 parent 9c46c09 commit c10531c

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

TS.fsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -329,15 +329,11 @@ let EmitMethods flavor prefix (emitScope: EmitScope) (i: Browser.Interface) =
329329
let emitMethodFromJson (m: ItemsType.Root) =
330330
m.Signatures |> Array.iter (Pt.printl "%s%s;" prefix)
331331

332-
// Because eventhandler overload are not inherited between interfaces,
333-
// they need to be taken care of seperately
334-
let hasEventHandlers =
335-
iNameToEhList.ContainsKey i.Name &&
336-
not iNameToEhList.[i.Name].IsEmpty
337-
332+
// If prefix is not empty, then this is the global declare function addEventListener, we want to override this
333+
// Otherwise, this is EventTarget.addEventListener, we want to keep that.
338334
let mFilter (m:Browser.Method) =
339335
matchScope emitScope m &&
340-
not (hasEventHandlers && OptionCheckValue "addEventListener" m.Name)
336+
not (prefix <> "" && OptionCheckValue "addEventListener" m.Name)
341337

342338
if i.Methods.IsSome then
343339
i.Methods.Value.Methods

baselines/dom.generated.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13651,7 +13651,6 @@ declare function scroll(options?: ScrollToOptions): void;
1365113651
declare function scrollTo(options?: ScrollToOptions): void;
1365213652
declare function scrollBy(options?: ScrollToOptions): void;
1365313653
declare function toString(): string;
13654-
declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
1365513654
declare function dispatchEvent(evt: Event): boolean;
1365613655
declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
1365713656
declare function clearInterval(handle: number): void;

baselines/webworker.generated.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,6 @@ declare var self: WorkerGlobalScope;
12261226
declare function close(): void;
12271227
declare function msWriteProfilerMark(profilerMarkName: string): void;
12281228
declare function toString(): string;
1229-
declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
12301229
declare function dispatchEvent(evt: Event): boolean;
12311230
declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;
12321231
declare var indexedDB: IDBFactory;

0 commit comments

Comments
 (0)