22export type BaseTocItem = {
33 fullPath : string
44 title : string
5- intro ?: string
5+ intro ?: string | null
66}
77
88// Valid octicon types that match the CookBookArticleCard component
@@ -23,19 +23,19 @@ export type ValidOcticon =
2323
2424// Extended type for child TOC items with additional metadata
2525export type ChildTocItem = BaseTocItem & {
26- octicon ?: ValidOcticon
27- category ?: string [ ]
28- complexity ?: string [ ]
29- industry ?: string [ ]
26+ octicon ?: ValidOcticon | null
27+ category ?: string [ ] | null
28+ complexity ?: string [ ] | null
29+ industry ?: string [ ] | null
3030}
3131
3232// Main TOC item type that can contain children
3333export type TocItem = BaseTocItem & {
3434 childTocItems ?: ChildTocItem [ ]
35- octicon ?: ValidOcticon
36- category ?: string [ ]
37- complexity ?: string [ ]
38- industry ?: string [ ]
35+ octicon ?: ValidOcticon | null
36+ category ?: string [ ] | null
37+ complexity ?: string [ ] | null
38+ industry ?: string [ ] | null
3939}
4040
4141// Type alias for article card components
@@ -90,11 +90,11 @@ export function mapRawTocItemToTocItem(raw: RawTocItem): TocItem {
9090 return {
9191 fullPath : raw . fullPath ,
9292 title : raw . title ,
93- intro : raw . intro || undefined ,
94- octicon : isValidOcticon ( raw . octicon ) ? raw . octicon : undefined ,
95- category : raw . category || undefined ,
96- complexity : raw . complexity || undefined ,
97- industry : raw . industry || undefined ,
93+ intro : raw . intro || null ,
94+ octicon : isValidOcticon ( raw . octicon ) ? raw . octicon : null ,
95+ category : raw . category || null ,
96+ complexity : raw . complexity || null ,
97+ industry : raw . industry || null ,
9898 childTocItems : raw . childTocItems ?. map ( mapRawTocItemToTocItem ) ,
9999 }
100100}
@@ -104,7 +104,7 @@ export function mapRawTocItemToSimpleTocItem(raw: RawTocItem): SimpleTocItem {
104104 return {
105105 fullPath : raw . fullPath ,
106106 title : raw . title ,
107- intro : raw . intro || undefined ,
107+ ... ( raw . intro && { intro : raw . intro } ) ,
108108 childTocItems : raw . childTocItems ?. map ( ( child ) => ( {
109109 fullPath : child . fullPath ,
110110 title : child . title ,
0 commit comments