File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
packages/react/src/components Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -17,16 +17,19 @@ export interface CategoryGroup {
1717 exports : SpecExport [ ] ;
1818}
1919
20+ const DISPLAY_KIND_SET : Set < string > = new Set ( DISPLAY_KIND_ORDER ) ;
21+ function isDisplayKind ( kind : string ) : kind is DisplayKind {
22+ return DISPLAY_KIND_SET . has ( kind ) ;
23+ }
24+
2025export function groupExportsByKind ( exports : SpecExport [ ] ) : CategoryGroup [ ] {
2126 const groups = new Map < DisplayKind , SpecExport [ ] > ( ) ;
2227
2328 for ( const exp of exports ) {
24- const kind = exp . kind as string ;
25- if ( ! ( DISPLAY_KIND_ORDER as string [ ] ) . includes ( kind ) ) continue ;
26- const displayKind = kind as DisplayKind ;
27- const list = groups . get ( displayKind ) || [ ] ;
29+ if ( ! isDisplayKind ( exp . kind ) ) continue ;
30+ const list = groups . get ( exp . kind ) || [ ] ;
2831 list . push ( exp ) ;
29- groups . set ( displayKind , list ) ;
32+ groups . set ( exp . kind , list ) ;
3033 }
3134
3235 return DISPLAY_KIND_ORDER . filter ( ( kind ) => groups . has ( kind ) ) . map ( ( kind ) => ( {
You can’t perform that action at this time.
0 commit comments