refactor(VNode): improve helper types (#392)
This commit is contained in:
parent
e581b14dff
commit
e7e3eb8662
@ -232,7 +232,10 @@ export function createVNode(
|
|||||||
return vnode
|
return vnode
|
||||||
}
|
}
|
||||||
|
|
||||||
export function cloneVNode(vnode: VNode, extraProps?: Data): VNode {
|
export function cloneVNode<T, U>(
|
||||||
|
vnode: VNode<T, U>,
|
||||||
|
extraProps?: Data
|
||||||
|
): VNode<T, U> {
|
||||||
// This is intentionally NOT using spread or extend to avoid the runtime
|
// This is intentionally NOT using spread or extend to avoid the runtime
|
||||||
// key enumeration cost.
|
// key enumeration cost.
|
||||||
return {
|
return {
|
||||||
@ -279,7 +282,7 @@ export function createCommentVNode(
|
|||||||
: createVNode(Comment, null, text)
|
: createVNode(Comment, null, text)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function normalizeVNode(child: VNodeChild): VNode {
|
export function normalizeVNode<T, U>(child: VNodeChild<T, U>): VNode<T, U> {
|
||||||
if (child == null) {
|
if (child == null) {
|
||||||
// empty placeholder
|
// empty placeholder
|
||||||
return createVNode(Comment)
|
return createVNode(Comment)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user