5
5
* @typedef {import('unist').Point } Point
6
6
* @typedef {import('hast').Element } Element
7
7
* @typedef {import('hast').Root } Root
8
- * @typedef {import('hast').Content } Content
8
+ * @typedef {import('hast').RootContent } RootContent
9
+ * @typedef {import('hast').Nodes } Nodes
9
10
* @typedef {import('parse5').DefaultTreeAdapterMap } DefaultTreeAdapterMap
10
11
* @typedef {import('parse5').Token.ElementLocation } P5ElementLocation
11
12
* @typedef {import('parse5').Token.Location } P5Location
12
13
*/
13
14
14
15
/**
15
- * @typedef {Content | Root } Node
16
16
* @typedef {DefaultTreeAdapterMap['document'] } P5Document
17
17
* @typedef {DefaultTreeAdapterMap['documentFragment'] } P5DocumentFragment
18
18
* @typedef {DefaultTreeAdapterMap['documentType'] } P5DocumentType
@@ -72,7 +72,7 @@ const proto = Object.prototype
72
72
* `parse5` tree to transform.
73
73
* @param {Options | VFile | null | undefined } [options]
74
74
* Configuration.
75
- * @returns {Node }
75
+ * @returns {Nodes }
76
76
* hast tree.
77
77
*/
78
78
export function fromParse5 ( tree , options ) {
@@ -108,11 +108,11 @@ export function fromParse5(tree, options) {
108
108
* Info passed around about the current state.
109
109
* @param {P5Node } node
110
110
* p5 node.
111
- * @returns {Node }
111
+ * @returns {Nodes }
112
112
* hast node.
113
113
*/
114
114
function one ( state , node ) {
115
- /** @type {Node } */
115
+ /** @type {Nodes } */
116
116
let result
117
117
118
118
switch ( node . nodeName ) {
@@ -151,7 +151,6 @@ function one(state, node) {
151
151
152
152
case '#documentType' : {
153
153
const reference = /** @type {P5DocumentType } */ ( node )
154
- // @ts -expect-error Types are out of date.
155
154
result = { type : 'doctype' }
156
155
patch ( state , reference , result )
157
156
return result
@@ -180,12 +179,12 @@ function one(state, node) {
180
179
* Info passed around about the current state.
181
180
* @param {Array<P5Node> } nodes
182
181
* Nodes.
183
- * @returns {Array<Content > }
182
+ * @returns {Array<RootContent > }
184
183
* hast nodes.
185
184
*/
186
185
function all ( state , nodes ) {
187
186
let index = - 1
188
- /** @type {Array<Content > } */
187
+ /** @type {Array<RootContent > } */
189
188
const result = [ ]
190
189
191
190
while ( ++ index < nodes . length ) {
@@ -260,7 +259,7 @@ function element(state, node) {
260
259
* Info passed around about the current state.
261
260
* @param {P5Node } from
262
261
* p5 node.
263
- * @param {Node } to
262
+ * @param {Nodes } to
264
263
* hast node.
265
264
* @returns {void }
266
265
* Nothing.
@@ -281,7 +280,7 @@ function patch(state, from, to) {
281
280
*
282
281
* @param {State } state
283
282
* Info passed around about the current state.
284
- * @param {Node } node
283
+ * @param {Nodes } node
285
284
* hast node.
286
285
* @param {P5ElementLocation } location
287
286
* p5 location info.
0 commit comments