Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document.adoptedStyleSheets is no longer readonly #129

Open
rmartine-ias opened this issue Jun 11, 2024 · 0 comments
Open

Document.adoptedStyleSheets is no longer readonly #129

rmartine-ias opened this issue Jun 11, 2024 · 0 comments

Comments

@rmartine-ias
Copy link

Document.adoptedStyleSheets is no longer readonly: https://developer.mozilla.org/en-US/docs/Web/API/Document/adoptedStyleSheets

In an earlier version of the specification, the array was not modifiable, so the only way to add new stylesheets was to assign a new array to adoptedStyleSheets.

This causes issues with newer typescript (I'm using 5.3) that is aware of this.
For me, tsc --skipLibCheck false --incremental false was failing.

Here is the diff that solved my problem:

diff --git a/node_modules/construct-style-sheets-polyfill/dist/adoptedStyleSheets.d.ts b/node_modules/construct-style-sheets-polyfill/dist/adoptedStyleSheets.d.ts
index aa3d57a..c84a5e9 100644
--- a/node_modules/construct-style-sheets-polyfill/dist/adoptedStyleSheets.d.ts
+++ b/node_modules/construct-style-sheets-polyfill/dist/adoptedStyleSheets.d.ts
@@ -6,9 +6,9 @@ interface CSSStyleSheet {
 }
 
 interface Document {
-  adoptedStyleSheets: readonly CSSStyleSheet[];
+  adoptedStyleSheets: CSSStyleSheet[];
 }
 
 interface ShadowRoot {
-  adoptedStyleSheets: readonly CSSStyleSheet[];
+  adoptedStyleSheets: CSSStyleSheet[];
 }

This issue body was partially generated by patch-package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant