this is my first come here ask questions.
this my code
let nb: Element;
if (sc.hasChildNodes() == true) {
let lc = sc.lastChild!;
lc.insertBefore(newButton, lc);
nb = sc.lastChild!;
}
get error : Type 'ChildNode' is missing the following properties from type 'Element': attributes, classList, className, clientHeight, and 106 more.
---------- Update ----------
just need to know what is " Type Assertions "
this update code
let nb: Element;
if (sc.hasChildNodes() == true) {
sc.lastChild!.after(newButton);
nb = sc.lastChild! as Element;
}