@@ -18,7 +18,7 @@ import {
18
18
Prop
19
19
} from 'vue'
20
20
21
- import { MountingOptions } from './types'
21
+ import { RenderMountingOptions } from './types'
22
22
import { createInstance } from './createInstance'
23
23
24
24
// NOTE this should come from `vue`
@@ -31,7 +31,7 @@ type ComponentMountingOptions<T> = T extends DefineComponent<
31
31
any ,
32
32
any
33
33
>
34
- ? MountingOptions <
34
+ ? RenderMountingOptions <
35
35
Partial < ExtractDefaultPropTypes < PropsOrPropOptions > > &
36
36
Omit <
37
37
Readonly < ExtractPropTypes < PropsOrPropOptions > > & PublicProps ,
@@ -40,15 +40,15 @@ type ComponentMountingOptions<T> = T extends DefineComponent<
40
40
D
41
41
> &
42
42
Record < string , any >
43
- : MountingOptions < any >
43
+ : RenderMountingOptions < any >
44
44
45
45
// Class component (without vue-class-component) - no props
46
46
export function renderToString < V extends { } > (
47
47
originalComponent : {
48
48
new ( ...args : any [ ] ) : V
49
49
__vccOpts : any
50
50
} ,
51
- options ?: MountingOptions < any > & Record < string , any >
51
+ options ?: RenderMountingOptions < any > & Record < string , any >
52
52
) : Promise < string >
53
53
54
54
// Class component (without vue-class-component) - props
@@ -58,7 +58,7 @@ export function renderToString<V extends {}, P>(
58
58
__vccOpts : any
59
59
defaultProps ?: Record < string , Prop < any > > | string [ ]
60
60
} ,
61
- options ?: MountingOptions < P & PublicProps > & Record < string , any >
61
+ options ?: RenderMountingOptions < P & PublicProps > & Record < string , any >
62
62
) : Promise < string >
63
63
64
64
// Class component - no props
@@ -67,7 +67,7 @@ export function renderToString<V extends {}>(
67
67
new ( ...args : any [ ] ) : V
68
68
registerHooks ( keys : string [ ] ) : void
69
69
} ,
70
- options ?: MountingOptions < any > & Record < string , any >
70
+ options ?: RenderMountingOptions < any > & Record < string , any >
71
71
) : Promise < string >
72
72
73
73
// Class component - props
@@ -77,13 +77,13 @@ export function renderToString<V extends {}, P>(
77
77
props ( Props : P ) : any
78
78
registerHooks ( keys : string [ ] ) : void
79
79
} ,
80
- options ?: MountingOptions < P & PublicProps > & Record < string , any >
80
+ options ?: RenderMountingOptions < P & PublicProps > & Record < string , any >
81
81
) : Promise < string >
82
82
83
83
// Functional component with emits
84
84
export function renderToString < Props extends { } , E extends EmitsOptions = { } > (
85
85
originalComponent : FunctionalComponent < Props , E > ,
86
- options ?: MountingOptions < Props & PublicProps > & Record < string , any >
86
+ options ?: RenderMountingOptions < Props & PublicProps > & Record < string , any >
87
87
) : Promise < string >
88
88
89
89
// Component declared with defineComponent
@@ -115,7 +115,7 @@ export function renderToString<
115
115
Props ,
116
116
Defaults
117
117
> ,
118
- options ?: MountingOptions <
118
+ options ?: RenderMountingOptions <
119
119
Partial < Defaults > & Omit < Props & PublicProps , keyof Defaults > ,
120
120
D
121
121
> &
@@ -150,7 +150,7 @@ export function renderToString<
150
150
Extends ,
151
151
EE
152
152
> ,
153
- options ?: MountingOptions < Props & PublicProps , D >
153
+ options ?: RenderMountingOptions < Props & PublicProps , D >
154
154
) : Promise < string >
155
155
156
156
// Component declared with { props: [] }
@@ -180,7 +180,7 @@ export function renderToString<
180
180
EE ,
181
181
Props
182
182
> ,
183
- options ?: MountingOptions < Props & PublicProps , D >
183
+ options ?: RenderMountingOptions < Props & PublicProps , D >
184
184
) : Promise < string >
185
185
186
186
// Component declared with { props: { ... } }
@@ -208,10 +208,17 @@ export function renderToString<
208
208
Extends ,
209
209
EE
210
210
> ,
211
- options ?: MountingOptions < ExtractPropTypes < PropsOptions > & PublicProps , D >
211
+ options ?: RenderMountingOptions <
212
+ ExtractPropTypes < PropsOptions > & PublicProps ,
213
+ D
214
+ >
212
215
) : Promise < string >
213
216
214
217
export function renderToString ( component : any , options ?: any ) : Promise < string > {
218
+ if ( options ?. attachTo ) {
219
+ console . warn ( 'attachTo option is not available for renderToString' )
220
+ }
221
+
215
222
const { app } = createInstance ( component , options )
216
223
return baseRenderToString ( app )
217
224
}
0 commit comments