-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
adapter-cloudflare@1.0.0-next.36 ambient.d.ts breaks DOM manipulation function types #8268
Comments
Presumably you can use a |
Yes, if I litter enough (It still shouldn't complain, and now it's just a minefield of what web standard API does Cloudflare break next.) |
This also broke a place where I do
with eslint complaining
and that seems to be because Cloudflare overrides response.json to be
while
This spooky action at a distance property is like the worst part of Typescript :-( |
Describe the bug
(This bug also occurs with
@sveltejs/adapter-cloudflare@1.0.0
, I'm talking about1.0.0-next.36
because that's what introduced the issue.)I need a workaround for an ugly Safari bug, which forces me to do some HTML rewriting before I use
@html
. I useDOMParser.parseFromString
and some light DOM manipulation for this. This function is only called whenbrowser
from$app/environment
is true.Upgrading to @sveltejs/adapter-cloudflare@1.0.0-next.36 broke the Typescript DOM API:
That
child
there is of typeElement
, andElement.after
absolutely should take aHTMLDivElement
. Looking up the type definition ofchild.after
in an IDE leads tonode_modules/@cloudflare/workers-types/index.d.ts
which has the incorrectIt seems PR #6917 caused ambient.d.ts referencing Cloudflare's types make them override the DOM API types:
kit/packages/adapter-cloudflare-workers/ambient.d.ts
Line 1 in 4b7fc72
It seems this only triggers if the tsconfig workspace contains a file that actually imports
@sveltejs/adapter-cloudflare
. In my case, I havesvelte.config.js
added to tsconfig so I get useful IDE feedback.Reproduction
https://github.com/tv42/sveltekit-issue-cloudflare-dom
The latest commit has
svelte-check
complainingYou can checkout the commit before it switched to @sveltejs/adapter-cloudflare@1.0.0-next.36, run
npm i
, and observenpm run check
be happy.Note how triggering this hinges on the commit that edited
tsconfig.json
.Logs
No response
System Info
Severity
blocking an upgrade
Additional Information
No response
The text was updated successfully, but these errors were encountered: