1
1
/**
2
2
* @typedef {import('property-information').Schema } Schema
3
3
* @typedef {import('hast').Root } HastRoot
4
- * @typedef {import('hast').DocType } HastDoctype
4
+ * @typedef {import('hast').Doctype } HastDoctype
5
5
* @typedef {import('hast').Element } HastElement
6
6
* @typedef {import('hast').Comment } HastComment
7
7
* @typedef {import('hast').Text } HastText
8
- * @typedef {import('hast').Content } HastContent
8
+ * @typedef {import('hast').Nodes } HastNodes
9
9
* @typedef {import('xast').Root } XastRoot
10
10
* @typedef {import('xast').Element } XastElement
11
11
* @typedef {import('xast').Text } XastText
12
12
* @typedef {import('xast').Comment } XastComment
13
13
* @typedef {import('xast').Doctype } XastDoctype
14
14
* @typedef {import('xast').Attributes } XastAttributes
15
- * @typedef {import('xast').RootChildMap } XastRootChildMap
16
- * @typedef {import('xast').ElementChildMap } XastElementChildMap
15
+ * @typedef {import('xast').RootContent } XastRootContent
16
+ * @typedef {import('xast').Nodes } XastNodes
17
+ * @typedef {import('xast').ElementContent } XastElementContent
17
18
*/
18
19
19
20
/**
20
- * @typedef {XastRootChildMap[keyof XastRootChildMap] } XastContent
21
- * @typedef {XastRoot | XastContent } XastNode
22
- * @typedef {HastRoot | HastContent } HastNode
23
- *
24
21
* @typedef {'html' | 'svg' } Space
25
22
* Namespace.
26
23
*
@@ -53,7 +50,7 @@ import {zwitch} from 'zwitch'
53
50
54
51
const own = { } . hasOwnProperty
55
52
56
- /** @type {(node: HastNode , state: State) => XastNode } */
53
+ /** @type {(node: HastNodes , state: State) => XastNodes } */
57
54
const one = zwitch ( 'type' , {
58
55
handlers : { root, element, text, comment, doctype} ,
59
56
invalid,
@@ -63,11 +60,11 @@ const one = zwitch('type', {
63
60
/**
64
61
* Turn a hast tree into a xast tree.
65
62
*
66
- * @param {HastNode } tree
63
+ * @param {HastNodes } tree
67
64
* hast tree to transform.
68
65
* @param {Space | Options | null | undefined } [options]
69
66
* Configuration.
70
- * @returns {XastNode }
67
+ * @returns {XastNodes }
71
68
* xast tree.
72
69
*/
73
70
export function toXast ( tree , options ) {
@@ -116,7 +113,7 @@ function unknown(value) {
116
113
* xast node.
117
114
*/
118
115
function root ( node , state ) {
119
- /** @type {Array<XastContent > } */
116
+ /** @type {Array<XastRootContent > } */
120
117
const children = [ ]
121
118
let index = - 1
122
119
@@ -262,7 +259,7 @@ function element(node, state) {
262
259
}
263
260
}
264
261
265
- /** @type {Array<XastElementChildMap[keyof XastElementChildMap] > } */
262
+ /** @type {Array<XastElementContent > } */
266
263
const children = [ ]
267
264
let index = - 1
268
265
@@ -293,8 +290,8 @@ function element(node, state) {
293
290
}
294
291
295
292
/**
296
- * @param {HastNode } origin
297
- * @param {XastNode } node
293
+ * @param {HastNodes } origin
294
+ * @param {XastNodes } node
298
295
* @returns {void }
299
296
*/
300
297
function patch ( origin , node ) {
0 commit comments