types: use stricter HostNode typings
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
import { createRenderer, VNode, createAppAPI } from '@vue/runtime-core'
|
||||
import { createRenderer } from '@vue/runtime-core'
|
||||
import { nodeOps } from './nodeOps'
|
||||
import { patchProp } from './patchProp'
|
||||
|
||||
export const render = createRenderer({
|
||||
const { render, createApp } = createRenderer<Node, Element>({
|
||||
patchProp,
|
||||
...nodeOps
|
||||
}) as (vnode: VNode | null, container: HTMLElement) => void
|
||||
})
|
||||
|
||||
export const createApp = createAppAPI(render)
|
||||
export { render, createApp }
|
||||
|
||||
// re-export everything from core
|
||||
// h, Component, reactivity API, nextTick, flags & types
|
||||
export * from '@vue/runtime-core'
|
||||
|
||||
export interface ComponentPublicInstance {
|
||||
$el: Element
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ export function patchEvent(
|
||||
name: string,
|
||||
prevValue: EventValue | null,
|
||||
nextValue: EventValue | null,
|
||||
instance: ComponentInternalInstance | null
|
||||
instance: ComponentInternalInstance | null = null
|
||||
) {
|
||||
const invoker = prevValue && prevValue.invoker
|
||||
if (nextValue) {
|
||||
|
||||
@@ -36,5 +36,6 @@ export const nodeOps = {
|
||||
|
||||
nextSibling: (node: Node): Node | null => node.nextSibling,
|
||||
|
||||
querySelector: (selector: string): Node | null => doc.querySelector(selector)
|
||||
querySelector: (selector: string): Element | null =>
|
||||
doc.querySelector(selector)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { patchAttr } from './modules/attrs'
|
||||
import { patchDOMProp } from './modules/props'
|
||||
import { patchEvent } from './modules/events'
|
||||
import { isOn } from '@vue/shared'
|
||||
import { VNode } from '@vue/runtime-core'
|
||||
import { VNode, ComponentInternalInstance } from '@vue/runtime-core'
|
||||
|
||||
export function patchProp(
|
||||
el: Element,
|
||||
@@ -13,7 +13,7 @@ export function patchProp(
|
||||
prevValue: any,
|
||||
isSVG: boolean,
|
||||
prevChildren?: VNode[],
|
||||
parentComponent?: any,
|
||||
parentComponent?: ComponentInternalInstance,
|
||||
unmountChildren?: any
|
||||
) {
|
||||
switch (key) {
|
||||
|
||||
Reference in New Issue
Block a user