Prevent HTMLRewriter Element interface conflicting with browser Element interface

I'm working on a project where the client and worker share type definitions. Upon adding the type definitions for @cloudflare/workers-types, my client code started having issues compiling, which after some investigation I found was caused by the Element interface used by the HTMLRewriter API conflicting with the browser Element interface. More specifically, Element.append, Element.prepend, Element.before, and Element.after take a string argument for HTMLRewriter, but take Nodes as arguments in the browser. I am still new to TypeScript so I might just be structuring my project poorly, but I'm wondering if there's a way to apply these type definitions to only the worker portion of my project (it is in a separate folder within the project folder).
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?