Skip to content

Commit 392703b

Browse files
fix: update project to work with built-in ElementInternals types
1 parent 2d2ca18 commit 392703b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: src/element-internals.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ export function isElementInternalsSupported(): boolean {
285285
}
286286

287287
if (!isElementInternalsSupported()) {
288+
/** @ts-expect-error: we need to replace the default ElementInternals */
288289
window.ElementInternals = ElementInternals;
289290

290291

@@ -313,11 +314,11 @@ if (!isElementInternalsSupported()) {
313314
*/
314315
Object.defineProperty(HTMLElement.prototype, 'attachInternals', {
315316
get() {
316-
return () => {
317+
return (): IElementInternals => {
317318
if (this.tagName.indexOf('-') === -1) {
318319
throw new Error(`Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.`);
319320
}
320-
return new ElementInternals(this);
321+
return new ElementInternals(this) as IElementInternals;
321322
};
322323
}
323324
});

0 commit comments

Comments
 (0)