types: refactor VNodeProps type

This commit is contained in:
Evan You
2019-11-01 09:58:27 -04:00
parent 28895b8817
commit 06c5b0a861
4 changed files with 17 additions and 23 deletions

View File

@@ -14,7 +14,7 @@ import {
} from './component'
import { RawSlots } from './componentSlots'
import { ShapeFlags } from './shapeFlags'
import { isReactive } from '@vue/reactivity'
import { isReactive, Ref } from '@vue/reactivity'
import { AppContext } from './apiApp'
import { SuspenseBoundary, isSuspenseType } from './suspense'
import { DirectiveBinding } from './directives'
@@ -39,6 +39,12 @@ export type VNodeTypes =
| typeof Comment
| typeof SuspenseImpl
export interface VNodeProps {
[key: string]: any
key?: string | number
ref?: string | Ref | Function
}
type VNodeChildAtom<HostNode, HostElement> =
| VNode<HostNode, HostElement>
| string
@@ -66,7 +72,7 @@ export type NormalizedChildren<HostNode = any, HostElement = any> =
export interface VNode<HostNode = any, HostElement = any> {
_isVNode: true
type: VNodeTypes
props: Record<any, any> | null
props: VNodeProps | null
key: string | number | null
ref: string | Function | null
children: NormalizedChildren<HostNode, HostElement>