diff --git a/src/lib/utils/getContainerNode.ts b/src/lib/utils/getContainerNode.ts index 2d306903faa..03974f7aefc 100644 --- a/src/lib/utils/getContainerNode.ts +++ b/src/lib/utils/getContainerNode.ts @@ -23,7 +23,7 @@ function getContainerNode(selectorOrHTMLElement: string | HTMLElement) { throw new Error(errorMessage); } - return domElement as HTMLElement; + return domElement; } export default getContainerNode; diff --git a/src/lib/utils/isDomElement.js b/src/lib/utils/isDomElement.ts similarity index 63% rename from src/lib/utils/isDomElement.js rename to src/lib/utils/isDomElement.ts index 209101947ce..7f5ec9aa9e1 100644 --- a/src/lib/utils/isDomElement.js +++ b/src/lib/utils/isDomElement.ts @@ -1,5 +1,6 @@ -function isDomElement(object) { +function isDomElement(object: any): object is HTMLElement { return ( + // @ts-ignore object instanceof window.HTMLElement || (Boolean(object) && object.nodeType > 0) );