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

Not compatible with @xmldom/xmldom@^0.9.1: Argument of type 'Document' is not assignable to parameter of type 'Node'. #144

Open
mateusz-plociennik opened this issue Sep 5, 2024 · 3 comments

Comments

@mateusz-plociennik
Copy link

var nodes = xpath.select("//title", doc);

The line above gives me the following error:

lib/commands/find.ts:66:40 - error TS2769: No overload matches this call.
  Overload 1 of 3, '(expression: string, node: Node, single: false): SelectReturnType', gave the following error.
    Argument of type 'Document' is not assignable to parameter of type 'Node'.
      Type 'Document' is missing the following properties from type 'Node': baseURI, isConnected, parentElement, textContent, and 7 more.
  Overload 2 of 3, '(expression: string, node: Node, single: true): SelectedValue', gave the following error.
    Argument of type 'Document' is not assignable to parameter of type 'Node'.

66   const nodes = xpath.select(selector, doc, false);
@mateusz-plociennik
Copy link
Author

See xmldom/xmldom#724

@karfau
Copy link

karfau commented Sep 8, 2024

What properties of Node does xpath need to do it's job?
xmldom now finally only specifies the properties it actually implements.

By using `Pick<Node, ...> it should be possible to still use libs like xmldom, that do not provide all properties.

One reason for us to vendor the subset of types that we support, was that people complained about the globals that xmldom added without implementing them, just because it referenced the dom stuff in it's type definition. And on our side there are no current plans of implementing all those props, so it would feel weird to go with the suggestion to add the types for them or add an implementation throwing a NotImplementedError, since it communicates that we are planning to implement them...

@Ponynjaa
Copy link

Ponynjaa commented Sep 9, 2024

@karfau some if not most of the required properties are actually already there, just not correctly maintained within the index.d.ts as mentioned in xmldom/xmldom#725. I will try to add them in the following days if I get the time to do so since it also makes our code kinda messy.

bph-sag added a commit to bph-sag/apama-vscode-extensions that referenced this issue Sep 25, 2024
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

3 participants