types: simplify types (#104)

This commit is contained in:
月迷津渡
2019-10-05 22:09:34 +08:00
committed by Evan You
parent ca70aff860
commit 9d6783053c
12 changed files with 50 additions and 71 deletions

View File

@@ -77,7 +77,7 @@ function getComponentTrace(): ComponentTraceStack {
recurseCount: 0
})
}
const parentInstance: ComponentInternalInstance | null = (currentVNode.component as ComponentInternalInstance)
const parentInstance: ComponentInternalInstance | null = currentVNode.component!
.parent
currentVNode = parentInstance && parentInstance.vnode
}
@@ -107,10 +107,7 @@ function formatTraceEntry(
recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``
const open = padding + `<${formatComponentName(vnode)}`
const close = `>` + postfix
const rootLabel =
(vnode.component as ComponentInternalInstance).parent == null
? `(Root)`
: ``
const rootLabel = vnode.component!.parent == null ? `(Root)` : ``
return vnode.props
? [open, ...formatProps(vnode.props), close, rootLabel]
: [open + close, rootLabel]