Skip to content

Consider making the Node type used throughout XmlRenderer generic #5

Description

@DrRataplan

Hey there,

I've been using xml-renderer for a bit and I noticed the Node type used in a bunch of places in the codebase is of the type globalThis.Node: the browser built-in variant. This usually works out fine.

I've been using xml-renderer in combination with another DOM implementation: slimdom. At that point, if you want to use some more specific slimdom functions, such as calling XMLSerializer#serializeToString with a node that is coming out of xml-renderer, Typescript warns me about the fact that globalThis.Node is not compatible with slimdom.Node. You'll have to typecast the xml-renderer Node (which is the browser Node type) to slimdom.Node (which is what slimdom accepts).

If xml-renderer would be generic on the Node type, I could pass slimdom.Node and have more powerful typing. Other libraries, such as FontoXPath will then also pick those typings up, making it easier for me to work with xml-renderer.

What would be your thoughts?

Regard,

Martin

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions