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
xmldom types include globals that don't exist in Node #49953
Comments
@justinfagnani thank you for reporting the issue! Can you try something to see if it works as I understood the docs: - /// <reference lib="dom" />
+ /// <reference types="dom" /> and check if your problem is solved. Thank you |
@Karfu that doesn't work since |
Maybe the built in dom types shouldn't be used at all. xmldom doesn't implement the entire interface for the built in Document and Element types. It's at least missing the querySelector functions. |
I think you are right. And I think the effort to either manually write or generate the types that are actually supported is not to big. |
FYI updates are now published as We have discussion of the |
Related issues for other libs: #55382, node-fetch/node-fetch#1285 Ideas to fix this issue properly: microsoft/TypeScript-DOM-lib-generator#1207, microsoft/TypeScript#33111, microsoft/TypeScript#43990 |
@types/xxxx
package and had problems.@types
package versions do not follow SemVer.Definitions by:
inindex.d.ts
) so they can respond.The xmldom types reference TypeScript's DOM typings with
/// <reference lib="dom" />
. This causes any module that imports xmldom to get the entire DOM typings, including globals likedocument
.With those globals defined we lose errors when accidentally referencing them, which can obviously cause crashes.
It'd be great if xmldom could pick off only the DOM types that it uses and exports, like
DOMImplementation
,Document
,Node
, etc. I'm not sure if this is possible with lib.dom.d.tsThe text was updated successfully, but these errors were encountered: