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

@@ -29,7 +29,7 @@ export function renderComponentRoot(
currentRenderingInstance = instance
try {
if (vnode.shapeFlag & ShapeFlags.STATEFUL_COMPONENT) {
result = normalizeVNode((instance.render as Function).call(renderProxy))
result = normalizeVNode(instance.render!.call(renderProxy))
} else {
// functional
const render = Component as FunctionalComponent
@@ -66,12 +66,12 @@ export function shouldUpdateComponent(
}
if (patchFlag & PatchFlags.FULL_PROPS) {
// presence of this flag indicates props are always non-null
return hasPropsChanged(prevProps as Data, nextProps as Data)
return hasPropsChanged(prevProps!, nextProps!)
} else if (patchFlag & PatchFlags.PROPS) {
const dynamicProps = nextVNode.dynamicProps as string[]
const dynamicProps = nextVNode.dynamicProps!
for (let i = 0; i < dynamicProps.length; i++) {
const key = dynamicProps[i]
if ((nextProps as any)[key] !== (prevProps as any)[key]) {
if (nextProps![key] !== prevProps![key]) {
return true
}
}