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

Element.getElementsByTagName marked as deprecated #61264

Open
mozesstumpf opened this issue Feb 25, 2025 · 4 comments
Open

Element.getElementsByTagName marked as deprecated #61264

mozesstumpf opened this issue Feb 25, 2025 · 4 comments
Labels
Needs More Info The issue still hasn't been fully clarified

Comments

@mozesstumpf
Copy link

⚙ Compilation target

ESNext

⚙ Library

5.6.3

Missing / Incorrect Definition

Element.getElementsByTagName marked as deprecated if the Element is a union type

Sample Code

declare const el: HTMLDivElement;

// it's okay
el.getElementsByTagName;

declare const unionEl: HTMLDivElement | HTMLSpanElement;

// marked as deprecated
unionEl.getElementsByTagName;

Documentation Link

No response

@RyanCavanaugh
Copy link
Member

I can't repro this

Image

@RyanCavanaugh RyanCavanaugh added the Needs More Info The issue still hasn't been fully clarified label Feb 25, 2025
@mozesstumpf
Copy link
Author

I can't repro this

Could you check on this repo?
https://github.com/mozesstumpf/getElementsByTagsName-issue

Image

@snarbles2
Copy link

Just curious what you see when you go to the definition of this member. I couldn't reproduce it either, which makes sense given the declarations I'm seeing (5.6.3/ESNext).

    getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
    getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;
    getElementsByTagName<K extends keyof MathMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<MathMLElementTagNameMap[K]>;
    /** @deprecated */
    getElementsByTagName<K extends keyof HTMLElementDeprecatedTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementDeprecatedTagNameMap[K]>;
    getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;

@nmain
Copy link

nmain commented Feb 26, 2025

I can reproduce this readily in VSCode, but I'm not sure whether the error is VSCode, Typescript, or the plumbing between them.

Image

In that setting, both quick info and go to definition show the first overload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs More Info The issue still hasn't been fully clarified
Projects
None yet
Development

No branches or pull requests

4 participants