Add better type check utils for HTMLLike

This commit is contained in:
2019-07-22 18:47:32 +05:30
parent c239b1b6d1
commit 4af377f1ba
+8 -2
View File
@@ -1,5 +1,11 @@
function isNodeSimple(node) {
import { FiberNode, FiberNodeisHTMLLike } from './mocked-types';
function isHtmlLike(node: FiberNode): node is FiberNodeisHTMLLike {
return (typeof node.type === "string") || node.type === null;
}
export { isNodeSimple };
function isNotHtmlLike(node: FiberNode): node is Exclude<FiberNode, FiberNodeisHTMLLike> {
return (typeof node.type === "string") || node.type === null;
}
export { isHtmlLike, isNotHtmlLike };