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 = {
9292 return { }
9393 }
9494
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'
9898 )
9999
100100 if ( topLevelStyleTags . length === 0 ) {
Original file line number Diff line number Diff line change @@ -59,9 +59,10 @@ module.exports = {
5959 if ( ! documentFragment ) {
6060 return { }
6161 }
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+ )
6566 if ( scripts . every ( ( script ) => ! utils . hasAttribute ( script , 'lang' , 'ts' ) ) ) {
6667 return { }
6768 }
Original file line number Diff line number Diff line change @@ -2643,9 +2643,10 @@ function getScriptSetupElement(context) {
26432643 if ( ! df ) {
26442644 return null
26452645 }
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+ )
26492650 if ( scripts . length === 2 ) {
26502651 return scripts . find ( ( e ) => hasAttribute ( e , 'setup' ) ) || null
26512652 } else {
Original file line number Diff line number Diff line change @@ -580,9 +580,10 @@ function buildPseudoNthVElementMatcher(testIndex) {
580580 */
581581function buildPseudoNthOfTypeVElementMatcher ( testIndex ) {
582582 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+ )
586587 return testIndex ( elements . indexOf ( element ) , elements . length )
587588 }
588589}
Original file line number Diff line number Diff line change @@ -47,9 +47,10 @@ function getStyleVariablesContext(context) {
4747 if ( ! df ) {
4848 return null
4949 }
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+ )
5354 if ( styles . length === 0 ) {
5455 return null
5556 }
You can’t perform that action at this time.
0 commit comments