@@ -7,8 +7,6 @@ import {space} from 'sentry/styles/space';
77import { useLocation } from 'sentry/utils/useLocation' ;
88import type { StoriesQuery } from 'sentry/views/stories/types' ;
99
10- type DirContent = Record < string , unknown > ;
11-
1210interface Props extends ComponentProps < 'div' > {
1311 files : string [ ] ;
1412}
@@ -23,17 +21,16 @@ export default function StoryTree({files, style}: Props) {
2321 ) ;
2422}
2523
26- function FolderContent ( { path, content} : { content : DirContent ; path : string } ) {
24+ function FolderContent ( { path, content} : { content : TreeMapping ; path : string } ) {
2725 const location = useLocation < StoriesQuery > ( ) ;
2826 const currentFile = location . query . name ;
2927
3028 return (
3129 < UnorderedList >
3230 { Object . entries ( content ) . map ( ( [ name , children ] ) => {
33- const childContent = children as DirContent ;
3431 const childPath = toPath ( path , name ) ;
3532
36- if ( Object . keys ( childContent ) . length === 0 ) {
33+ if ( Object . keys ( children ) . length === 0 ) {
3734 const isCurrent = childPath === currentFile ? true : undefined ;
3835 const to = `/stories/?name=${ childPath } ` ;
3936 return (
@@ -50,7 +47,7 @@ function FolderContent({path, content}: {content: DirContent; path: string}) {
5047 < ListItem key = { name } >
5148 < Folder open >
5249 < FolderName > { name } </ FolderName >
53- < FolderContent path = { childPath } content = { childContent } />
50+ < FolderContent path = { childPath } content = { children } />
5451 </ Folder >
5552 </ ListItem >
5653 ) ;
@@ -59,7 +56,9 @@ function FolderContent({path, content}: {content: DirContent; path: string}) {
5956 ) ;
6057}
6158
62- function toTree ( files : string [ ] ) {
59+ interface TreeMapping extends Record < string , TreeMapping > { }
60+
61+ function toTree ( files : string [ ] ) : TreeMapping {
6362 const root = { } ;
6463 for ( const file of files ) {
6564 const parts = file . split ( '/' ) ;
0 commit comments