Skip to content

Commit c4ed721

Browse files
committed
Add missing inline docs
1 parent fde3379 commit c4ed721

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

index.js

+6
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,37 @@
1919

2020
/**
2121
* @template {Jsx} [JsxFunction=Jsx]
22+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
2223
* @typedef {import('./lib/index.js').CreateEvaluater<JsxFunction>} CreateEvaluater
2324
*/
2425

2526
/**
2627
* @template {Jsx} [JsxFunction=Jsx]
28+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
2729
* @typedef {import('./lib/index.js').EvaluateExpression<JsxFunction>} EvaluateExpression
2830
*/
2931

3032
/**
3133
* @template {Jsx} [JsxFunction=Jsx]
34+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
3235
* @typedef {import('./lib/index.js').Evaluater<JsxFunction>} Evaluater
3336
*/
3437

3538
/**
3639
* @template {Jsx} [JsxFunction=Jsx]
40+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
3741
* @typedef {import('./lib/index.js').JsxDev<JsxFunction>} JsxDev
3842
*/
3943

4044
/**
4145
* @template {Jsx} [JsxFunction=Jsx]
46+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
4247
* @typedef {import('./lib/index.js').Options<JsxFunction>} Options
4348
*/
4449

4550
/**
4651
* @template {Jsx} [JsxFunction=Jsx]
52+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
4753
* @typedef {import('./lib/index.js').Props<JsxFunction>} Props
4854
*/
4955

lib/index.js

+47
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@
3131

3232
/**
3333
* @template {Jsx} [JsxFunction=Jsx]
34+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
3435
* @typedef {ReturnType<JsxFunction> | string | null | undefined} Child
3536
* Child.
3637
*/
3738

3839
/**
3940
* @template {Jsx} [JsxFunction=Jsx]
41+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
4042
* @callback Create
4143
* Create something in development or production.
4244
* @param {Nodes} node
@@ -53,6 +55,7 @@
5355

5456
/**
5557
* @template {Jsx} [JsxFunction=Jsx]
58+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
5659
* @callback CreateEvaluater
5760
* Create an evaluator that turns ESTree ASTs from embedded MDX into values.
5861
* @returns {Evaluater<JsxFunction>}
@@ -69,6 +72,7 @@
6972

7073
/**
7174
* @template {Jsx} [JsxFunction=Jsx]
75+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
7276
* @callback EvaluateExpression
7377
* Turn an MDX expression into a value.
7478
* @param {Expression} expression
@@ -90,6 +94,7 @@
9094

9195
/**
9296
* @template {Jsx} [JsxFunction=Jsx]
97+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
9398
* @typedef Evaluater
9499
* Evaluator that turns ESTree ASTs from embedded MDX into values.
95100
* @property {EvaluateExpression<JsxFunction>} evaluateExpression
@@ -105,33 +110,46 @@
105110

106111
/**
107112
* @template [JsxElementType=any]
113+
* Element type: `Fragment` symbol, tag name (`string`), component.
108114
* @template [JsxProps=any]
115+
* Element props, `children`, and maybe `node`.
109116
* @template [JsxKey=any]
117+
* Dynamicly generated key to use.
110118
* @template [JsxElement=any]
119+
* Analogous to `JSX.Element`.
111120
* @callback Jsx
121+
* Create a production element.
112122
* @param {JsxElementType} type
123+
* Element type: `Fragment` symbol, tag name (`string`), component.
113124
* @param {JsxProps} props
125+
* Element props, `children`, and maybe `node`.
114126
* @param {JsxKey} [key]
127+
* Dynamicly generated key to use.
115128
* @returns {JsxElement}
129+
* Element from your framework.
116130
*/
117131

118132
/**
119133
* @template {Jsx} [JsxFunction=Jsx]
134+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
120135
* @typedef {Parameters<JsxFunction>[0]} GetType
121136
*/
122137

123138
/**
124139
* @template {Jsx} [JsxFunction=Jsx]
140+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
125141
* @typedef {Parameters<JsxFunction>[1]} GetProps
126142
*/
127143

128144
/**
129145
* @template {Jsx} [JsxFunction=Jsx]
146+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
130147
* @typedef {Parameters<JsxFunction>[2]} GetKey
131148
*/
132149

133150
/**
134151
* @template {Jsx} [JsxFunction=Jsx]
152+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
135153
* @callback JsxDev
136154
* Create a development element.
137155
* @param {GetType<JsxFunction>} type
@@ -153,6 +171,7 @@
153171

154172
/**
155173
* @template {Jsx} [JsxFunction=Jsx]
174+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
156175
* @typedef {{
157176
* children?: Array<Child<JsxFunction>> | Child<JsxFunction>, node?: Element | MdxJsxFlowElement | MdxJsxTextElement | undefined,
158177
* [prop: string]: Array<Child<JsxFunction>> | Child<JsxFunction> | Element | MdxJsxFlowElement | MdxJsxTextElement | Value | undefined
@@ -162,6 +181,7 @@
162181

163182
/**
164183
* @template {Jsx} [JsxFunction=Jsx]
184+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
165185
* @typedef RegularFields
166186
* Configuration.
167187
* @property {Record<string, GetType<JsxFunction>>} [components]
@@ -200,6 +220,7 @@
200220

201221
/**
202222
* @template {Jsx} [JsxFunction=Jsx]
223+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
203224
* @typedef RuntimeDevelopment
204225
* Runtime fields when development is on.
205226
* @property {GetType<JsxFunction>} Fragment
@@ -216,6 +237,7 @@
216237

217238
/**
218239
* @template {Jsx} [JsxFunction=Jsx]
240+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
219241
* @typedef RuntimeProduction
220242
* Runtime fields when development is off.
221243
* @property {GetType<JsxFunction>} Fragment
@@ -231,6 +253,7 @@
231253

232254
/**
233255
* @template {Jsx} [JsxFunction=Jsx]
256+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
234257
* @typedef RuntimeUnknown
235258
* Runtime fields when development might be on or off.
236259
* @property {GetType<JsxFunction>} Fragment
@@ -269,6 +292,7 @@
269292

270293
/**
271294
* @template {Jsx} [JsxFunction=Jsx]
295+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
272296
* @typedef State
273297
* Info passed around.
274298
* @property {GetType<JsxFunction>} Fragment
@@ -319,24 +343,28 @@
319343

320344
/**
321345
* @template {Jsx} [JsxFunction=Jsx]
346+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
322347
* @typedef {RuntimeDevelopment<JsxFunction> & RegularFields<JsxFunction>} Development
323348
* Configuration (development).
324349
*/
325350

326351
/**
327352
* @template {Jsx} [JsxFunction=Jsx]
353+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
328354
* @typedef {Development<JsxFunction> | Production<JsxFunction>} Options
329355
* Configuration.
330356
*/
331357

332358
/**
333359
* @template {Jsx} [JsxFunction=Jsx]
360+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
334361
* @typedef {RegularFields<JsxFunction> & RuntimeProduction<JsxFunction>} Production
335362
* Configuration (production).
336363
*/
337364

338365
/**
339366
* @template {Jsx} [JsxFunction=Jsx]
367+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
340368
* @typedef {RegularFields<JsxFunction> & RuntimeUnknown<JsxFunction>} Unknown
341369
* Configuration (production or development).
342370
*/
@@ -381,6 +409,7 @@ const docs = 'https://github.com/syntax-tree/hast-util-to-jsx-runtime'
381409
* with an automatic JSX runtime.
382410
*
383411
* @template {Jsx} [JsxFunction=Jsx]
412+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
384413
* @param {Nodes} tree
385414
* Tree to transform.
386415
* @param {Options<JsxFunction>} options
@@ -455,6 +484,7 @@ export function toJsxRuntime(tree, options) {
455484
* Transform a node.
456485
*
457486
* @template {Jsx} [JsxFunction=Jsx]
487+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
458488
* @param {State<JsxFunction>} state
459489
* Info passed around.
460490
* @param {Nodes} node
@@ -494,6 +524,7 @@ function one(state, node, key) {
494524
* Handle element.
495525
*
496526
* @template {Jsx} [JsxFunction=Jsx]
527+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
497528
* @param {State<JsxFunction>} state
498529
* Info passed around.
499530
* @param {Element} node
@@ -538,6 +569,7 @@ function element(state, node, key) {
538569
* Handle MDX expression.
539570
*
540571
* @template {Jsx} [JsxFunction=Jsx]
572+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
541573
* @param {State<JsxFunction>} state
542574
* Info passed around.
543575
* @param {MdxFlowExpression | MdxTextExpression} node
@@ -564,6 +596,7 @@ function mdxExpression(state, node) {
564596
* Handle MDX ESM.
565597
*
566598
* @template {Jsx} [JsxFunction=Jsx]
599+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
567600
* @param {State<JsxFunction>} state
568601
* Info passed around.
569602
* @param {MdxjsEsm} node
@@ -587,6 +620,7 @@ function mdxEsm(state, node) {
587620
*
588621
*
589622
* @template {Jsx} [JsxFunction=Jsx]
623+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
590624
* @param {State<JsxFunction>} state
591625
* Info passed around.
592626
* @param {MdxJsxFlowElement | MdxJsxTextElement} node
@@ -628,6 +662,7 @@ function mdxJsxElement(state, node, key) {
628662
* Handle root.
629663
*
630664
* @template {Jsx} [JsxFunction=Jsx]
665+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
631666
* @param {State<JsxFunction>} state
632667
* Info passed around.
633668
* @param {Root} node
@@ -650,6 +685,7 @@ function root(state, node, key) {
650685
* Handle text.
651686
*
652687
* @template {Jsx} [JsxFunction=Jsx]
688+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
653689
* @param {State<JsxFunction>} _
654690
* Info passed around.
655691
* @param {Text} node
@@ -665,6 +701,7 @@ function text(_, node) {
665701
* Add `node` to props.
666702
*
667703
* @template {Jsx} [JsxFunction=Jsx]
704+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
668705
* @param {State<JsxFunction>} state
669706
* Info passed around.
670707
* @param {Props<JsxFunction>} props
@@ -687,6 +724,7 @@ function addNode(state, props, type, node) {
687724
* Add children to props.
688725
*
689726
* @template {Jsx} [JsxFunction=Jsx]
727+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
690728
* @param {Props<JsxFunction>} props
691729
* Props.
692730
* @param {Array<Child<JsxFunction>>} children
@@ -706,6 +744,7 @@ function addChildren(props, children) {
706744

707745
/**
708746
* @template {Jsx} [JsxFunction=Jsx]
747+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
709748
* @param {string | undefined} _
710749
* Path to file.
711750
* @param {JsxFunction} jsx
@@ -728,6 +767,7 @@ function productionCreate(_, jsx, jsxs) {
728767

729768
/**
730769
* @template {Jsx} [JsxFunction=Jsx]
770+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
731771
* @param {string | undefined} filePath
732772
* Path to file.
733773
* @param {JsxDev<JsxFunction>} jsxDEV
@@ -761,6 +801,7 @@ function developmentCreate(filePath, jsxDEV) {
761801
* Create props from an element.
762802
*
763803
* @template {Jsx} [JsxFunction=Jsx]
804+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
764805
* @param {State<JsxFunction>} state
765806
* Info passed around.
766807
* @param {Element} node
@@ -811,6 +852,7 @@ function createElementProps(state, node) {
811852
* Create props from a JSX element.
812853
*
813854
* @template {Jsx} [JsxFunction=Jsx]
855+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
814856
* @param {State<JsxFunction>} state
815857
* Info passed around.
816858
* @param {MdxJsxFlowElement | MdxJsxTextElement} node
@@ -876,6 +918,7 @@ function createJsxElementProps(state, node) {
876918
* Create children.
877919
*
878920
* @template {Jsx} [JsxFunction=Jsx]
921+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
879922
* @param {State<JsxFunction>} state
880923
* Info passed around.
881924
* @param {Parents} node
@@ -924,6 +967,7 @@ function createChildren(state, node) {
924967
* Handle a property.
925968
*
926969
* @template {Jsx} [JsxFunction=Jsx]
970+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
927971
* @param {State<JsxFunction>} state
928972
* Info passed around.
929973
* @param {string} prop
@@ -975,6 +1019,7 @@ function createProperty(state, prop, value) {
9751019
* Parse a CSS declaration to an object.
9761020
*
9771021
* @template {Jsx} [JsxFunction=Jsx]
1022+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
9781023
* @param {State<JsxFunction>} state
9791024
* Info passed around.
9801025
* @param {string} value
@@ -1035,6 +1080,7 @@ function parseStyle(state, value) {
10351080
* Create a JSX name from a string.
10361081
*
10371082
* @template {Jsx} [JsxFunction=Jsx]
1083+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
10381084
* @param {State<JsxFunction>} state
10391085
* To do.
10401086
* @param {string} name
@@ -1101,6 +1147,7 @@ function findComponentFromName(state, name, allowExpression) {
11011147

11021148
/**
11031149
* @template {Jsx} [JsxFunction=Jsx]
1150+
* The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
11041151
* @param {State<JsxFunction>} state
11051152
* @param {Position | undefined} [place]
11061153
* @returns {never}

0 commit comments

Comments
 (0)