From 3f515f62e7c9037a313b14e96d5227d5e712bda9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?= Date: Mon, 18 Mar 2019 17:53:31 +0100 Subject: [PATCH] fix(utils): type isDomElement --- src/lib/utils/getContainerNode.ts | 2 +- src/lib/utils/{isDomElement.js => isDomElement.ts} | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) rename src/lib/utils/{isDomElement.js => isDomElement.ts} (63%) 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) );