1
1
import {
2
2
cloneVNode ,
3
- Comment ,
3
+ Comment as CommentVNode ,
4
4
type Component ,
5
5
type ComponentOptions ,
6
6
createCommentVNode ,
7
7
createTextVNode ,
8
- Fragment ,
8
+ Fragment as FragmentVNode ,
9
9
type FunctionalComponent ,
10
10
isVNode ,
11
- Static ,
12
- Text ,
11
+ Static as StaticVNode ,
12
+ Text as TextVNode ,
13
13
type VNode ,
14
14
type VNodeArrayChildren ,
15
15
type VNodeChild
@@ -18,7 +18,7 @@ import {
18
18
// @ts -ignore
19
19
const DEV = process . env . NODE_ENV !== 'production'
20
20
21
- export const isComment = ( vnode : unknown ) : vnode is ( null | undefined | boolean | ( VNode & { type : Comment } ) ) => {
21
+ export const isComment = ( vnode : unknown ) : vnode is ( null | undefined | boolean | ( VNode & { type : typeof CommentVNode } ) ) => {
22
22
return getType ( vnode ) === 'comment'
23
23
}
24
24
@@ -30,7 +30,7 @@ export const isElement = (vnode: unknown): vnode is (VNode & { type: string }) =
30
30
return getType ( vnode ) === 'element'
31
31
}
32
32
33
- export const isFragment = ( vnode : unknown ) : vnode is ( ( VNode & { type : typeof Fragment } ) | VNodeArrayChildren ) => {
33
+ export const isFragment = ( vnode : unknown ) : vnode is ( ( VNode & { type : typeof FragmentVNode } ) | VNodeArrayChildren ) => {
34
34
return getType ( vnode ) === 'fragment'
35
35
}
36
36
@@ -42,11 +42,11 @@ export const isStatefulComponent = (vnode: unknown): vnode is (VNode & { type: C
42
42
return isComponent ( vnode ) && typeof vnode . type === 'object'
43
43
}
44
44
45
- export const isStatic = ( vnode : unknown ) : vnode is ( VNode & { type : typeof Static } ) => {
45
+ export const isStatic = ( vnode : unknown ) : vnode is ( VNode & { type : typeof StaticVNode } ) => {
46
46
return getType ( vnode ) === 'static'
47
47
}
48
48
49
- export const isText = ( vnode : unknown ) : vnode is ( string | number | ( VNode & { type : Text } ) ) => {
49
+ export const isText = ( vnode : unknown ) : vnode is ( string | number | ( VNode & { type : typeof TextVNode } ) ) => {
50
50
return getType ( vnode ) === 'text'
51
51
}
52
52
@@ -59,7 +59,7 @@ export const getText = (vnode: VNode | string | number): string | undefined => {
59
59
return String ( vnode )
60
60
}
61
61
62
- if ( isVNode ( vnode ) && vnode . type === Text ) {
62
+ if ( isVNode ( vnode ) && vnode . type === TextVNode ) {
63
63
return String ( vnode . children )
64
64
}
65
65
@@ -119,13 +119,13 @@ export const getType = (vnode: unknown) => {
119
119
const typeofType = typeof type
120
120
121
121
if ( typeofType === 'symbol' ) {
122
- if ( type === Fragment ) {
122
+ if ( type === FragmentVNode ) {
123
123
return 'fragment'
124
- } else if ( type === Text ) {
124
+ } else if ( type === TextVNode ) {
125
125
return 'text'
126
- } else if ( type === Comment ) {
126
+ } else if ( type === CommentVNode ) {
127
127
return 'comment'
128
- } else if ( type === Static ) {
128
+ } else if ( type === StaticVNode ) {
129
129
return 'static'
130
130
}
131
131
} else if ( typeofType === 'string' ) {
0 commit comments