File tree Expand file tree Collapse file tree 4 files changed +11
-9
lines changed
packages-private/dts-test Expand file tree Collapse file tree 4 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 11// TSX w/ defineComponent is tested in defineComponent.test-d.tsx
22import {
3- type Block ,
43 Fragment ,
54 KeepAlive ,
5+ type RenderReturn ,
66 Suspense ,
77 Teleport ,
88 type VNode ,
99} from 'vue'
1010import { expectType } from './utils'
1111
12- expectType < VNode | Block > ( < div /> )
12+ expectType < RenderReturn > ( < div /> )
1313expectType < JSX . Element > ( < div /> )
1414expectType < JSX . Element > ( < div id = "foo" /> )
1515expectType < JSX . Element > ( < div > hello</ div > )
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ export type VaporPublicProps = ReservedProps &
3232 AllowedComponentProps &
3333 ComponentCustomProps
3434
35+ export type RenderReturn = VNode | Block | ArrayRenderReturn
36+ type ArrayRenderReturn = Array < RenderReturn >
37+
3538export type DefineVaporComponent <
3639 RuntimePropsOptions = { } ,
3740 RuntimePropsKeys extends string = string ,
@@ -100,7 +103,7 @@ export function defineVaporComponent<
100103 attrs : Record < string , any >
101104 expose : ( exposed : Exposed ) => void
102105 } ,
103- ) => Block | VNode ,
106+ ) => RenderReturn ,
104107 extraOptions ?: ObjectVaporComponent <
105108 ( keyof Props ) [ ] ,
106109 Emits ,
@@ -125,7 +128,7 @@ export function defineVaporComponent<
125128 attrs : Record < string , any >
126129 expose : ( exposed : Exposed ) => void
127130 } ,
128- ) => Block | VNode ,
131+ ) => RenderReturn ,
129132 extraOptions ?: ObjectVaporComponent <
130133 ComponentObjectPropsOptions < Props > ,
131134 Emits ,
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ import {
1414 type ObjectEmitsOptions ,
1515 type ShallowUnwrapRef ,
1616 type SuspenseBoundary ,
17- type VNode ,
1817 callWithErrorHandling ,
1918 currentInstance ,
2019 endMeasure ,
@@ -67,7 +66,7 @@ import {
6766 insertionParent ,
6867 resetInsertionState ,
6968} from './insertionState'
70- import type { DefineVaporComponent } from './apiDefineComponent'
69+ import type { DefineVaporComponent , RenderReturn } from './apiDefineComponent'
7170
7271export { currentInstance } from '@vue/runtime-dom'
7372
@@ -118,7 +117,7 @@ export interface ObjectVaporComponent<
118117 emit : EmitFn < Emits > ,
119118 attrs : any ,
120119 slots : StaticSlots ,
121- ) : Block | VNode | void
120+ ) : RenderReturn
122121
123122 name ?: string
124123 vapor ?: boolean
Original file line number Diff line number Diff line change 22// global JSX namespace registration
33// somehow we have to copy=pase the jsx-runtime types here to make TypeScript happy
44import type { NativeElements , ReservedProps , VNode } from '@vue/runtime-dom'
5- import type { Block } from '@vue/runtime-vapor'
5+ import type { RenderReturn } from '@vue/runtime-vapor'
66
77declare global {
88 namespace JSX {
9- export type Element = VNode | Block | Element [ ]
9+ export type Element = RenderReturn
1010 export interface IntrinsicElements extends NativeElements {
1111 // allow arbitrary elements
1212 // @ts -ignore suppress ts:2374 = Duplicate string index signature.
You can’t perform that action at this time.
0 commit comments