File tree Expand file tree Collapse file tree 5 files changed +19
-15
lines changed Expand file tree Collapse file tree 5 files changed +19
-15
lines changed Original file line number Diff line number Diff line change @@ -92,9 +92,9 @@ module.exports = {
92
92
return { }
93
93
}
94
94
95
- const topLevelElements = documentFragment . children . filter ( isVElement )
96
- const topLevelStyleTags = topLevelElements . filter (
97
- ( element ) => element . rawName === 'style'
95
+ const topLevelStyleTags = documentFragment . children . filter (
96
+ /** @returns { element is VElement } */
97
+ ( element ) => isVElement ( element ) && element . rawName === 'style'
98
98
)
99
99
100
100
if ( topLevelStyleTags . length === 0 ) {
Original file line number Diff line number Diff line change @@ -59,9 +59,10 @@ module.exports = {
59
59
if ( ! documentFragment ) {
60
60
return { }
61
61
}
62
- const scripts = documentFragment . children
63
- . filter ( utils . isVElement )
64
- . filter ( ( element ) => element . name === 'script' )
62
+ const scripts = documentFragment . children . filter (
63
+ /** @returns {element is VElement } */
64
+ ( element ) => utils . isVElement ( element ) && element . name === 'script'
65
+ )
65
66
if ( scripts . every ( ( script ) => ! utils . hasAttribute ( script , 'lang' , 'ts' ) ) ) {
66
67
return { }
67
68
}
Original file line number Diff line number Diff line change @@ -2643,9 +2643,10 @@ function getScriptSetupElement(context) {
2643
2643
if ( ! df ) {
2644
2644
return null
2645
2645
}
2646
- const scripts = df . children
2647
- . filter ( isVElement )
2648
- . filter ( ( e ) => e . name === 'script' )
2646
+ const scripts = df . children . filter (
2647
+ /** @returns {e is VElement } */
2648
+ ( e ) => isVElement ( e ) && e . name === 'script'
2649
+ )
2649
2650
if ( scripts . length === 2 ) {
2650
2651
return scripts . find ( ( e ) => hasAttribute ( e , 'setup' ) ) || null
2651
2652
} else {
Original file line number Diff line number Diff line change @@ -580,9 +580,10 @@ function buildPseudoNthVElementMatcher(testIndex) {
580
580
*/
581
581
function buildPseudoNthOfTypeVElementMatcher ( testIndex ) {
582
582
return ( element ) => {
583
- const elements = element . parent . children
584
- . filter ( isVElement )
585
- . filter ( ( e ) => e . rawName === element . rawName )
583
+ const elements = element . parent . children . filter (
584
+ /** @returns {e is VElement } */
585
+ ( e ) => isVElement ( e ) && e . rawName === element . rawName
586
+ )
586
587
return testIndex ( elements . indexOf ( element ) , elements . length )
587
588
}
588
589
}
Original file line number Diff line number Diff line change @@ -47,9 +47,10 @@ function getStyleVariablesContext(context) {
47
47
if ( ! df ) {
48
48
return null
49
49
}
50
- const styles = df . children
51
- . filter ( isVElement )
52
- . filter ( ( e ) => e . name === 'style' )
50
+ const styles = df . children . filter (
51
+ /** @returns {e is VElement } */
52
+ ( e ) => isVElement ( e ) && e . name === 'style'
53
+ )
53
54
if ( styles . length === 0 ) {
54
55
return null
55
56
}
You can’t perform that action at this time.
0 commit comments