Skip to content

TS: Missing types for Document.documentElement and Element.tagName #720

Description

@Mathias-S

Describe the bug
Trying to access document.documentElement or Element.tagName with TypeScript gives a type error, even though these properties are supported.

To Reproduce

import { DOMImplementation } from '@xmldom/xmldom';

const doc = new DOMImplementation().createDocument(null, 'qualifiedName');
const documentElement = doc.documentElement;
// Property 'documentElement' does not exist on type 'Document'.

const element = doc.createElement('element');
const tagName = element.tagName;
// Property 'tagName' does not exist on type 'Element'.

Expected behavior
documentElement should be available with the type Element or Element | null and tagName should be available with the type string

Runtime & Version:
xmldom version: 0.9.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtypesAnything regarding Typescript

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions