types: cleanup renderer & hydration typing

This commit is contained in:
Evan You
2020-02-14 12:33:32 -05:00
parent 629ee75588
commit 80904e92b8
4 changed files with 88 additions and 57 deletions

View File

@@ -14,6 +14,11 @@ import { warn } from './warning'
import { PatchFlags, ShapeFlags, isReservedProp, isOn } from '@vue/shared'
import { RendererOptions } from './renderer'
export type RootHydrateFunction = (
vnode: VNode<Node, Element>,
container: Element
) => void
// Note: hydration is DOM-specific
// But we have to place it in core due to tight coupling with core - splitting
// it out creates a ton of unnecessary complexity.
@@ -23,7 +28,7 @@ export function createHydrationFunctions(
mountComponent: any, // TODO
patchProp: RendererOptions['patchProp']
) {
const hydrate = (vnode: VNode, container: Element) => {
const hydrate: RootHydrateFunction = (vnode, container) => {
if (__DEV__ && !container.hasChildNodes()) {
warn(`Attempting to hydrate existing markup but container is empty.`)
return