@@ -35,10 +35,16 @@ export type VueElementConstructor<P = {}> = {
35
35
36
36
// overload 1: direct setup function
37
37
export function defineCustomElement < Props , RawBindings = object > (
38
- setup : (
39
- props : Readonly < Props > ,
40
- ctx : SetupContext ,
41
- ) => RawBindings | RenderFunction ,
38
+ setup : ( props : Props , ctx : SetupContext ) => RawBindings | RenderFunction ,
39
+ options ?: Pick < ComponentOptions , 'name' | 'inheritAttrs' | 'emits' > & {
40
+ props ?: ( keyof Props ) [ ]
41
+ } ,
42
+ ) : VueElementConstructor < Props >
43
+ export function defineCustomElement < Props , RawBindings = object > (
44
+ setup : ( props : Props , ctx : SetupContext ) => RawBindings | RenderFunction ,
45
+ options ?: Pick < ComponentOptions , 'name' | 'inheritAttrs' | 'emits' > & {
46
+ props ?: ComponentObjectPropsOptions < Props >
47
+ } ,
42
48
) : VueElementConstructor < Props >
43
49
44
50
// overload 2: object format with no props
@@ -143,9 +149,13 @@ export function defineCustomElement<P>(
143
149
/*! #__NO_SIDE_EFFECTS__ */
144
150
export function defineCustomElement (
145
151
options : any ,
152
+ extraOptions ?: ComponentOptions ,
153
+ /**
154
+ * @internal
155
+ */
146
156
hydrate ?: RootHydrateFunction ,
147
157
) : VueElementConstructor {
148
- const Comp = defineComponent ( options ) as any
158
+ const Comp = defineComponent ( options , extraOptions ) as any
149
159
class VueCustomElement extends VueElement {
150
160
static def = Comp
151
161
constructor ( initialProps ?: Record < string , any > ) {
@@ -157,9 +167,12 @@ export function defineCustomElement(
157
167
}
158
168
159
169
/*! #__NO_SIDE_EFFECTS__ */
160
- export const defineSSRCustomElement = ( ( options : any ) => {
170
+ export const defineSSRCustomElement = ( (
171
+ options : any ,
172
+ extraOptions ?: ComponentOptions ,
173
+ ) => {
161
174
// @ts -expect-error
162
- return defineCustomElement ( options , hydrate )
175
+ return defineCustomElement ( options , extraOptions , hydrate )
163
176
} ) as typeof defineCustomElement
164
177
165
178
const BaseClass = (
0 commit comments