@@ -64,19 +64,21 @@ function generateRouteFileInfoLines(
64
64
routeNames : string [ ]
65
65
childrenNamedViews : string [ ] | null
66
66
} > {
67
- const children = node . children . size > 0 ? node . getChildrenDeepSorted ( ) : null
67
+ const deepChildren = node . children . size > 0
68
+ ? node . getChildrenDeepSorted ( )
69
+ : null
68
70
69
- const childrenNamedViews = children
71
+ const deepChildrenNamedViews = deepChildren
70
72
? Array . from (
71
73
new Set (
72
- children . flatMap ( ( child ) => Array . from ( child . value . components . keys ( ) ) )
74
+ deepChildren . flatMap ( ( child ) => Array . from ( child . value . components . keys ( ) ) )
73
75
)
74
76
)
75
77
: null
76
78
77
- const routeNames = [ node , ...node . getChildrenDeepSorted ( ) ]
78
- // an unnamed route cannot be accessed in types
79
- . filter ( ( node ) : node is TreeNode & { name : string } => ! ! node . name )
79
+ const routeNames : Array < Extract < TreeNode [ 'name' ] , string > > = [ node , ...( deepChildren ?? [ ] ) ]
80
+ // unnamed routes and routes that don't correspond to certain components cannot be accessed in types
81
+ . filter ( ( node ) : node is TreeNode & { name : string } => node . value . components . size > 0 && ! ! node . name )
80
82
. map ( ( node ) => node . name )
81
83
82
84
// Most of the time we only have one view, but with named views we can have multiple.
@@ -86,7 +88,7 @@ function generateRouteFileInfoLines(
86
88
: Array . from ( node . value . components . values ( ) ) . map ( ( file ) => ( {
87
89
key : relative ( rootDir , file ) . replaceAll ( '\\' , '/' ) ,
88
90
routeNames,
89
- childrenNamedViews,
91
+ childrenNamedViews : deepChildrenNamedViews ,
90
92
} ) )
91
93
92
94
const childrenRouteInfo = node
0 commit comments