19
19
* @typedef {import('vfile').VFile } VFile
20
20
*
21
21
* @typedef {{
22
- * parse(nodes: NlcstContent[] ): NlcstRoot
22
+ * parse(nodes: Array< NlcstContent> ): NlcstRoot
23
23
* tokenizeSource(value: string): NlcstSource
24
24
* tokenizeWhiteSpace(value: string): NlcstWhiteSpace
25
- * tokenizeParagraph(nodes: NlcstSentenceContent[] ): NlcstParagraph
26
- * tokenize(value: string): NlcstSentenceContent[]
25
+ * tokenizeParagraph(nodes: Array< NlcstSentenceContent> ): NlcstParagraph
26
+ * tokenize(value: string): Array< NlcstSentenceContent>
27
27
* }} ParserInstance
28
28
* @typedef {new () => ParserInstance } ParserConstructor
29
29
*/
@@ -104,7 +104,7 @@ export function toNlcst(tree, file, Parser) {
104
104
const doc = String ( file )
105
105
const loc = location ( doc )
106
106
const parser = 'parse' in Parser ? Parser : new Parser ( )
107
- /** @type {NlcstContent[] } */
107
+ /** @type {Array< NlcstContent> } */
108
108
const results = [ ]
109
109
110
110
find ( tree )
@@ -136,7 +136,7 @@ export function toNlcst(tree, file, Parser) {
136
136
}
137
137
138
138
/**
139
- * @param {HastContent[] } children
139
+ * @param {Array< HastContent> } children
140
140
*/
141
141
function findAll ( children ) {
142
142
let index = - 1
@@ -147,11 +147,11 @@ export function toNlcst(tree, file, Parser) {
147
147
}
148
148
149
149
/**
150
- * @param {HastElementContent[] } children
151
- * @returns {HastElementContent[] }
150
+ * @param {Array< HastElementContent> } children
151
+ * @returns {Array< HastElementContent> }
152
152
*/
153
153
function flattenAll ( children ) {
154
- /** @type {HastElementContent[] } */
154
+ /** @type {Array< HastElementContent> } */
155
155
const results = [ ]
156
156
let index = - 1
157
157
@@ -176,10 +176,10 @@ export function toNlcst(tree, file, Parser) {
176
176
}
177
177
178
178
/**
179
- * @param {HastElementContent|HastElementContent[] } node
179
+ * @param {HastElementContent|Array< HastElementContent> } node
180
180
*/
181
181
function add ( node ) {
182
- /** @type {NlcstSentenceContent[] |undefined } */
182
+ /** @type {Array< NlcstSentenceContent> |undefined } */
183
183
const result = Array . isArray ( node ) ? all ( node ) : one ( node )
184
184
185
185
if ( result && result . length > 0 ) {
@@ -188,7 +188,7 @@ export function toNlcst(tree, file, Parser) {
188
188
}
189
189
190
190
/**
191
- * @param {HastElementContent[] } children
191
+ * @param {Array< HastElementContent> } children
192
192
*/
193
193
function implicit ( children ) {
194
194
let index = - 1
@@ -225,10 +225,10 @@ export function toNlcst(tree, file, Parser) {
225
225
* Convert `node` (hast) to nlcst.
226
226
*
227
227
* @param {HastContent } node
228
- * @returns {NlcstSentenceContent[] |undefined }
228
+ * @returns {Array< NlcstSentenceContent> |undefined }
229
229
*/
230
230
function one ( node ) {
231
- /** @type {NlcstSentenceContent[] |undefined } */
231
+ /** @type {Array< NlcstSentenceContent> |undefined } */
232
232
let replacement
233
233
/** @type {boolean|undefined } */
234
234
let change
@@ -259,11 +259,11 @@ export function toNlcst(tree, file, Parser) {
259
259
/**
260
260
* Convert all `children` (hast) to nlcst.
261
261
*
262
- * @param {HastContent[] } children
263
- * @returns {NlcstSentenceContent[] }
262
+ * @param {Array< HastContent> } children
263
+ * @returns {Array< NlcstSentenceContent> }
264
264
*/
265
265
function all ( children ) {
266
- /** @type {NlcstSentenceContent[] } */
266
+ /** @type {Array< NlcstSentenceContent> } */
267
267
const results = [ ]
268
268
let index = - 1
269
269
@@ -281,7 +281,7 @@ export function toNlcst(tree, file, Parser) {
281
281
* Note that nlcst nodes are concrete, meaning that their starting and ending
282
282
* positions can be inferred from their content.
283
283
*
284
- * @template {NlcstContent[] } T
284
+ * @template {Array< NlcstContent> } T
285
285
* @param {T } nodes
286
286
* @param {ReturnType<location> } location
287
287
* @param {number } offset
0 commit comments