Description
Hi, this is my first issue here so i'm trying my best and hope it'll work
and if it doesn't, let me know and i'll try to improve my feedback
I'm sharing this example:
const el = document.createElement('input')
const el2 = el.cloneNode()
el2.querySelector('')
In this example, the TypeScript parser sends an error: "Property 'querySelector' does not exist on type 'Node'."
However, in the real DOM (at least in Firefox, but i'm pretty sure in other browsers too), el2
is an HTMLInputElement
(like el
) and this property does exist on it
The type I see in the generated version of the dom library is:
cloneNode(deep?: boolean): Node;
and i feel it probably should be something like:
cloneNode<T extends Node>(deep?: boolean): T;
or maybe something with the type of this
, i'm not super-familiar yet with this part of TypeScript
I haven't taken the time to understand how this repo works, so i'm not sure how to transform this idea into a PR, but in any case, at this point, i'm more interested in understanding whether you agree on the problem i'm describing here
Thanks for your time reading this issue!