Typescript compile error: Property 'classList' does not exist on type 'Node'
I have got the same issue when I want to update the classList of the fist child.
And my solution is
const element = document.getElementById('testId').firstChild as HTMLElement;
This is becuase getElementsByClassName
is defined to return Node
array and not an Element
array.
Not all that familiar with how d.ts files work so is this my error or is it a bug in the d.ts file that need to be reported
Based on https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName I would report it as an error.