@@ -89,7 +89,14 @@ function renderToString(vnode, context, opts) {
89
89
return res ;
90
90
}
91
91
92
+ /**
93
+ * @param {VNode } vnode
94
+ * @param {Record<string, unknown> } context
95
+ * @returns {string }
96
+ */
92
97
function renderFunctionComponent ( vnode , context ) {
98
+ // eslint-disable-next-line lines-around-comment
99
+ /** @type {string } */
93
100
let rendered ,
94
101
c = createComponent ( vnode , context ) ,
95
102
cctx = getContext ( vnode . type , context ) ;
@@ -115,11 +122,16 @@ function renderFunctionComponent(vnode, context) {
115
122
return rendered ;
116
123
}
117
124
125
+ /**
126
+ * @param {VNode } vnode
127
+ * @param {Record<string, unknown> } context
128
+ * @returns {VNode }
129
+ */
118
130
function renderClassComponent ( vnode , context ) {
119
131
let nodeName = vnode . type ,
120
132
cctx = getContext ( nodeName , context ) ;
121
133
122
- // c = new nodeName(props, context);
134
+ /** @type { import("preact").Component } */
123
135
let c = new nodeName ( vnode . props , cctx ) ;
124
136
vnode [ COMPONENT ] = c ;
125
137
c [ VNODE ] = vnode ;
@@ -153,6 +165,11 @@ function renderClassComponent(vnode, context) {
153
165
return c . render ( c . props , c . state , c . context ) ;
154
166
}
155
167
168
+ /**
169
+ * @param {string } name
170
+ * @param {boolean } isSvgMode
171
+ * @returns {string }
172
+ */
156
173
function normalizePropName ( name , isSvgMode ) {
157
174
if ( name === 'className' ) {
158
175
return 'class' ;
@@ -171,6 +188,11 @@ function normalizePropName(name, isSvgMode) {
171
188
return name ;
172
189
}
173
190
191
+ /**
192
+ * @param {string } name
193
+ * @param {string | Record<string, unknown> } v
194
+ * @returns {string }
195
+ */
174
196
function normalizePropValue ( name , v ) {
175
197
if ( name === 'style' && v != null && typeof v === 'object' ) {
176
198
return styleObjToCss ( v ) ;
@@ -186,7 +208,15 @@ function normalizePropValue(name, v) {
186
208
const isArray = Array . isArray ;
187
209
const assign = Object . assign ;
188
210
189
- /** The default export is an alias of `render()`. */
211
+ /**
212
+ * The default export is an alias of `render()`.
213
+ * @param {any } vnode
214
+ * @param {Record<string, unknown> } context
215
+ * @param {boolean } isSvgMode
216
+ * @param {any } selectValue
217
+ * @param {VNode | null } parent
218
+ * @returns {string }
219
+ */
190
220
function _renderToString ( vnode , context , isSvgMode , selectValue , parent ) {
191
221
// Ignore non-rendered VNodes/values
192
222
if ( vnode == null || vnode === true || vnode === false || vnode === '' ) {
0 commit comments