Satisfy strict null checks

pull/205/head
paldepind
parent f79af82881
commit dccd3d4800

@ -16,7 +16,9 @@ function post(_: any, vnode: VNode): void {
function destroy(vnode: VNode): void {
// Remove placeholder
vnode.elm && vnode.elm.parentElement.removeChild(vnode.elm);
if (vnode.elm !== undefined) {
(vnode.elm.parentElement as HTMLElement).removeChild(vnode.elm);
}
// Remove real element from where it was inserted
vnode.elm = (vnode.data as VNodeData).attachData.real;
}
@ -44,4 +46,4 @@ export function attachTo(target: Element, vnode: VNode): VNode {
hook.destroy = destroy;
return vnode;
};
export default attachTo;
export default attachTo;

@ -35,11 +35,11 @@ function appendChild(node: Node, child: Node): void {
node.appendChild(child);
}
function parentNode(node: Node): HTMLElement {
function parentNode(node: Node): HTMLElement | null {
return node.parentElement;
}
function nextSibling(node: Node): Node {
function nextSibling(node: Node): Node | null {
return node.nextSibling;
}
@ -63,4 +63,5 @@ export const htmlDomApi = {
tagName,
setTextContent,
} as DOMAPI;
export default htmlDomApi;
export default htmlDomApi;

Loading…
Cancel
Save