@@ -38,10 +38,16 @@ export type VueElementConstructor<P = {}> = {
38
38
39
39
// overload 1: direct setup function
40
40
export function defineCustomElement < Props , RawBindings = object > (
41
- setup : (
42
- props : Readonly < Props > ,
43
- ctx : SetupContext ,
44
- ) => RawBindings | RenderFunction ,
41
+ setup : ( props : Props , ctx : SetupContext ) => RawBindings | RenderFunction ,
42
+ options ?: Pick < ComponentOptions , 'name' | 'inheritAttrs' | 'emits' > & {
43
+ props ?: ( keyof Props ) [ ]
44
+ } ,
45
+ ) : VueElementConstructor < Props >
46
+ export function defineCustomElement < Props , RawBindings = object > (
47
+ setup : ( props : Props , ctx : SetupContext ) => RawBindings | RenderFunction ,
48
+ options ?: Pick < ComponentOptions , 'name' | 'inheritAttrs' | 'emits' > & {
49
+ props ?: ComponentObjectPropsOptions < Props >
50
+ } ,
45
51
) : VueElementConstructor < Props >
46
52
47
53
// overload 2: defineCustomElement with options object, infer props from options
@@ -127,9 +133,13 @@ export function defineCustomElement<P>(
127
133
/*! #__NO_SIDE_EFFECTS__ */
128
134
export function defineCustomElement (
129
135
options : any ,
136
+ extraOptions ?: ComponentOptions ,
137
+ /**
138
+ * @internal
139
+ */
130
140
hydrate ?: RootHydrateFunction ,
131
141
) : VueElementConstructor {
132
- const Comp = defineComponent ( options ) as any
142
+ const Comp = defineComponent ( options , extraOptions ) as any
133
143
class VueCustomElement extends VueElement {
134
144
static def = Comp
135
145
constructor ( initialProps ?: Record < string , any > ) {
@@ -141,9 +151,12 @@ export function defineCustomElement(
141
151
}
142
152
143
153
/*! #__NO_SIDE_EFFECTS__ */
144
- export const defineSSRCustomElement = ( ( options : any ) => {
154
+ export const defineSSRCustomElement = ( (
155
+ options : any ,
156
+ extraOptions ?: ComponentOptions ,
157
+ ) => {
145
158
// @ts -expect-error
146
- return defineCustomElement ( options , hydrate )
159
+ return defineCustomElement ( options , extraOptions , hydrate )
147
160
} ) as typeof defineCustomElement
148
161
149
162
const BaseClass = (
0 commit comments