Skip to content

Commit a94d780

Browse files
authored
fix: [#1154] Removes global typescript definition that was used for custom elements (#1840)
* fix: [#1154] Removes global typescript definition that was used for custom elements to solve typescript compilation when skipLibCheck is set to false * fix: [#1154] Removes global typescript definition that was used for custom elements to solve typescript compilation when skipLibCheck is set to false
1 parent 00d665b commit a94d780

File tree

8 files changed

+8
-24
lines changed

8 files changed

+8
-24
lines changed

packages/happy-dom/src/config/IHTMLElementTagNameMap.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,7 @@ import HTMLTrackElement from '../nodes/html-track-element/HTMLTrackElement.js';
6363
import HTMLUListElement from '../nodes/html-u-list-element/HTMLUListElement.js';
6464
import HTMLVideoElement from '../nodes/html-video-element/HTMLVideoElement.js';
6565

66-
// Makes it work with custom elements when they declare their own interface.
67-
declare global {
68-
/* eslint-disable @typescript-eslint/naming-convention */
69-
/* eslint-disable @typescript-eslint/no-empty-interface */
70-
interface HTMLElementTagNameMap {}
71-
/* eslint-enable @typescript-eslint/naming-convention */
72-
/* eslint-enable @typescript-eslint/no-empty-interface */
73-
}
74-
75-
export default interface IHTMLElementTagNameMap extends HTMLElementTagNameMap {
66+
export default interface IHTMLElementTagNameMap {
7667
a: HTMLAnchorElement;
7768
abbr: HTMLElement;
7869
address: HTMLElement;

packages/happy-dom/src/event/IEventListenerOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import AbortSignal from 'src/fetch/AbortSignal.js';
1+
import AbortSignal from '../fetch/AbortSignal.js';
22

33
export default interface IEventListenerOptions {
44
once?: boolean;

packages/happy-dom/src/nodes/html-media-element/HTMLMediaElement.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import ErrorEvent from '../../event/events/ErrorEvent.js';
21
import Event from '../../event/Event.js';
32
import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum.js';
43
import HTMLElement from '../html-element/HTMLElement.js';
@@ -105,14 +104,6 @@ export default class HTMLMediaElement extends HTMLElement {
105104
this[PropertySymbol.propertyEventListeners].set('onended', value);
106105
}
107106

108-
public get onerror(): ((event: ErrorEvent) => void) | null {
109-
return ElementEventAttributeUtility.getEventListener(this, 'onerror');
110-
}
111-
112-
public set onerror(value: ((event: ErrorEvent) => void) | null) {
113-
this[PropertySymbol.propertyEventListeners].set('onerror', value);
114-
}
115-
116107
public get onloadeddata(): ((event: Event) => void) | null {
117108
return ElementEventAttributeUtility.getEventListener(this, 'onloadeddata');
118109
}

packages/happy-dom/src/nodes/node/ICachedComputedStyleResult.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import CSSStyleDeclarationPropertyManager from '../../css/declaration/property-m
22
import ICachedResult from './ICachedResult.js';
33

44
export default interface ICachedComputedStyleResult extends ICachedResult {
5-
result: WeakRef<CSSStyleDeclarationPropertyManager | null> | null;
5+
result: WeakRef<CSSStyleDeclarationPropertyManager> | null;
66
}

packages/happy-dom/src/nodes/node/ICachedQuerySelectorResult.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import Element from '../element/Element.js';
22
import ICachedResult from './ICachedResult.js';
33

44
export default interface ICachedQuerySelectorResult extends ICachedResult {
5-
result: WeakRef<Element | null> | null;
5+
result: WeakRef<Element> | null;
66
}

packages/happy-dom/src/nodes/node/ICachedStyleResult.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import CSSStyleDeclarationPropertyManager from '../../css/declaration/property-m
22
import ICachedResult from './ICachedResult.js';
33

44
export default interface ICachedStyleResult extends ICachedResult {
5-
result: WeakRef<CSSStyleDeclarationPropertyManager | null> | null;
5+
result: WeakRef<CSSStyleDeclarationPropertyManager> | null;
66
}

packages/happy-dom/src/query-selector/QuerySelector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ export default class QuerySelector {
237237
}
238238

239239
const cachedItem: ICachedQuerySelectorItem = {
240-
result: <WeakRef<Element | null>>{
240+
result: <WeakRef<Element>>{
241241
deref: () => null
242242
}
243243
};

packages/happy-dom/tsconfig.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
"resolveJsonModule": true,
1414
"noUnusedLocals": true,
1515
"noUnusedParameters": true,
16+
"noImplicitReturns": false,
1617
"removeComments": false,
1718
"preserveConstEnums": true,
19+
"strict": false,
1820
"sourceMap": true,
1921
"skipLibCheck": true,
2022
"baseUrl": ".",

0 commit comments

Comments
 (0)