@@ -23,18 +23,17 @@ export default function mustache(parser) {
23
23
parser . allow_whitespace ( ) ;
24
24
parser . eat ( '}' , true ) ;
25
25
26
- parser . append (
27
- /** @type {import('#compiler').ExpressionTag } */ ( {
28
- type : 'ExpressionTag' ,
29
- start,
30
- end : parser . index ,
31
- expression,
32
- metadata : {
33
- contains_call_expression : false ,
34
- dynamic : false
35
- }
36
- } )
37
- ) ;
26
+ /** @type {ReturnType<typeof parser.append<import('#compiler').ExpressionTag>> } */
27
+ parser . append ( {
28
+ type : 'ExpressionTag' ,
29
+ start,
30
+ end : parser . index ,
31
+ expression,
32
+ metadata : {
33
+ contains_call_expression : false ,
34
+ dynamic : false
35
+ }
36
+ } ) ;
38
37
}
39
38
40
39
/** @param {import('../index.js').Parser } parser */
@@ -44,7 +43,8 @@ function open(parser) {
44
43
if ( parser . eat ( 'if' ) ) {
45
44
parser . require_whitespace ( ) ;
46
45
47
- const block = /** @type {typeof parser.append<import('#compiler').IfBlock> } */ ( parser . append ) ( {
46
+ /** @type {ReturnType<typeof parser.append<import('#compiler').IfBlock>> } */
47
+ const block = parser . append ( {
48
48
type : 'IfBlock' ,
49
49
elseif : false ,
50
50
start,
@@ -164,9 +164,8 @@ function open(parser) {
164
164
165
165
parser . eat ( '}' , true ) ;
166
166
167
- const block = /** @type {typeof parser.append<import('#compiler').EachBlock> } */ (
168
- parser . append
169
- ) ( {
167
+ /** @type {ReturnType<typeof parser.append<import('#compiler').EachBlock>> } */
168
+ const block = parser . append ( {
170
169
type : 'EachBlock' ,
171
170
start,
172
171
end : - 1 ,
@@ -189,9 +188,8 @@ function open(parser) {
189
188
const expression = read_expression ( parser ) ;
190
189
parser . allow_whitespace ( ) ;
191
190
192
- const block = /** @type {typeof parser.append<import('#compiler').AwaitBlock> } */ (
193
- parser . append
194
- ) ( {
191
+ /** @type {ReturnType<typeof parser.append<import('#compiler').AwaitBlock>> } */
192
+ const block = parser . append ( {
195
193
type : 'AwaitBlock' ,
196
194
start,
197
195
end : - 1 ,
@@ -244,15 +242,14 @@ function open(parser) {
244
242
245
243
parser . eat ( '}' , true ) ;
246
244
247
- const block = /** @type {typeof parser.append<import('#compiler').KeyBlock> } */ ( parser . append ) (
248
- {
249
- type : 'KeyBlock' ,
250
- start,
251
- end : - 1 ,
252
- expression,
253
- fragment : create_fragment ( )
254
- }
255
- ) ;
245
+ /** @type {ReturnType<typeof parser.append<import('#compiler').KeyBlock>> } */
246
+ const block = parser . append ( {
247
+ type : 'KeyBlock' ,
248
+ start,
249
+ end : - 1 ,
250
+ expression,
251
+ fragment : create_fragment ( )
252
+ } ) ;
256
253
257
254
parser . stack . push ( block ) ;
258
255
parser . fragments . push ( block . fragment ) ;
@@ -302,9 +299,8 @@ function open(parser) {
302
299
parser . allow_whitespace ( ) ;
303
300
parser . eat ( '}' , true ) ;
304
301
305
- const block = /** @type {typeof parser.append<import('#compiler').SnippetBlock> } */ (
306
- parser . append
307
- ) ( {
302
+ /** @type {ReturnType<typeof parser.append<import('#compiler').SnippetBlock>> } */
303
+ const block = parser . append ( {
308
304
type : 'SnippetBlock' ,
309
305
start,
310
306
end : - 1 ,
@@ -353,9 +349,8 @@ function next(parser) {
353
349
parser . allow_whitespace ( ) ;
354
350
parser . eat ( '}' , true ) ;
355
351
356
- const child = /** @type {typeof parser.append<import('#compiler').IfBlock> } */ (
357
- parser . append
358
- ) ( {
352
+ /** @type {ReturnType<typeof parser.append<import('#compiler').IfBlock>> } */
353
+ const child = parser . append ( {
359
354
start : parser . index ,
360
355
end : - 1 ,
361
356
type : 'IfBlock' ,
@@ -498,14 +493,13 @@ function special(parser) {
498
493
parser . allow_whitespace ( ) ;
499
494
parser . eat ( '}' , true ) ;
500
495
501
- parser . append (
502
- /** @type {import('#compiler').HtmlTag } */ ( {
503
- type : 'HtmlTag' ,
504
- start,
505
- end : parser . index ,
506
- expression
507
- } )
508
- ) ;
496
+ /** @type {ReturnType<typeof parser.append<import('#compiler').HtmlTag>> } */
497
+ parser . append ( {
498
+ type : 'HtmlTag' ,
499
+ start,
500
+ end : parser . index ,
501
+ expression
502
+ } ) ;
509
503
510
504
return ;
511
505
}
@@ -537,14 +531,13 @@ function special(parser) {
537
531
parser . eat ( '}' , true ) ;
538
532
}
539
533
540
- parser . append (
541
- /** @type {import('#compiler').DebugTag } */ ( {
542
- type : 'DebugTag' ,
543
- start,
544
- end : parser . index ,
545
- identifiers
546
- } )
547
- ) ;
534
+ /** @type {ReturnType<typeof parser.append<import('#compiler').DebugTag>> } */
535
+ parser . append ( {
536
+ type : 'DebugTag' ,
537
+ start,
538
+ end : parser . index ,
539
+ identifiers
540
+ } ) ;
548
541
549
542
return ;
550
543
}
@@ -563,20 +556,19 @@ function special(parser) {
563
556
564
557
parser . eat ( '}' , true ) ;
565
558
566
- parser . append (
567
- /** @type {import('#compiler').ConstTag } */ ( {
568
- type : 'ConstTag' ,
569
- start,
570
- end : parser . index ,
571
- declaration : {
572
- type : 'VariableDeclaration' ,
573
- kind : 'const' ,
574
- declarations : [ { type : 'VariableDeclarator' , id, init } ] ,
575
- start : start + 1 ,
576
- end : parser . index - 1
577
- }
578
- } )
579
- ) ;
559
+ /** @type {ReturnType<typeof parser.append<import('#compiler').ConstTag>> } */
560
+ parser . append ( {
561
+ type : 'ConstTag' ,
562
+ start,
563
+ end : parser . index ,
564
+ declaration : {
565
+ type : 'VariableDeclaration' ,
566
+ kind : 'const' ,
567
+ declarations : [ { type : 'VariableDeclarator' , id, init } ] ,
568
+ start : start + 1 ,
569
+ end : parser . index - 1
570
+ }
571
+ } ) ;
580
572
}
581
573
582
574
if ( parser . eat ( 'render' ) ) {
@@ -592,14 +584,13 @@ function special(parser) {
592
584
parser . allow_whitespace ( ) ;
593
585
parser . eat ( '}' , true ) ;
594
586
595
- parser . append (
596
- /** @type {import('#compiler').RenderTag } */ ( {
597
- type : 'RenderTag' ,
598
- start,
599
- end : parser . index ,
600
- expression : expression . callee ,
601
- arguments : expression . arguments
602
- } )
603
- ) ;
587
+ /** @type {ReturnType<typeof parser.append<import('#compiler').RenderTag>> } */
588
+ parser . append ( {
589
+ type : 'RenderTag' ,
590
+ start,
591
+ end : parser . index ,
592
+ expression : expression . callee ,
593
+ arguments : expression . arguments
594
+ } ) ;
604
595
}
605
596
}
0 commit comments