import { ComponentPublicInstance } from './componentProxy'
import { ExtractPropTypes } from './componentProps'
import { isFunction } from '@vue/shared'
-import { Ref } from '@vue/reactivity'
-
-interface BaseProps {
- [key: string]: any
- key?: string | number
- ref?: string | Ref | Function
-}
+import { VNodeProps } from './vnode'
// overload 1: direct setup function
// (uses user defined props interface)
{},
{},
// public props
- BaseProps & Props
+ VNodeProps & Props
>
}
D,
C,
M,
- BaseProps & Props
+ VNodeProps & Props
>
}
): {
__isConstructor: true
// array props technically doesn't place any contraints on props in TSX
- new (): ComponentPublicInstance<BaseProps, RawBindings, D, C, M>
+ new (): ComponentPublicInstance<VNodeProps, RawBindings, D, C, M>
}
// overload 4: object format with object props declaration
D,
C,
M,
- BaseProps & ExtractPropTypes<PropsOptions, false>
+ VNodeProps & ExtractPropTypes<PropsOptions, false>
>
}
import {
VNodeTypes,
VNode,
+ VNodeProps,
createVNode,
VNodeChildren,
Fragment,
Suspense
} from './vnode'
import { isObject, isArray } from '@vue/shared'
-import { Ref } from '@vue/reactivity'
import { RawSlots } from './componentSlots'
import { FunctionalComponent } from './component'
import {
h(Component, null, {})
**/
-export interface RawProps {
- [key: string]: any
- key?: string | number
- ref?: string | Ref | Function
+type RawProps = VNodeProps & {
// used to differ from a single VNode object as children
_isVNode?: never
// used to differ from Array children
[Symbol.iterator]?: never
}
-export type RawChildren =
+type RawChildren =
| string
| number
| boolean
| VNodeChildren
| (() => any)
-export { RawSlots }
-
// fake constructor type returned from `createComponent`
interface Constructor<P = any> {
new (): { $props: P }
// Types -----------------------------------------------------------------------
export { App, AppConfig, AppContext, Plugin } from './apiApp'
-export { RawProps, RawChildren, RawSlots } from './h'
-export { VNode, VNodeTypes } from './vnode'
+export { VNode, VNodeTypes, VNodeProps } from './vnode'
export {
Component,
FunctionalComponent,
} 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'
| 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
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>