diff --git a/apps/www/lib/rehype-component.ts b/apps/www/lib/rehype-component.ts index c43aa8d8721..f47962d4c9f 100644 --- a/apps/www/lib/rehype-component.ts +++ b/apps/www/lib/rehype-component.ts @@ -36,16 +36,13 @@ export function rehypeComponent() { src = path.join(process.cwd(), srcPath) } else { const component = Index[style.name][name] + src = fileName - ? component.files.find((file: unknown) => { - if (typeof file === "string") { - return ( - file.endsWith(`${fileName}.tsx`) || - file.endsWith(`${fileName}.ts`) - ) - } - return false - }) || component.files[0]?.path + ? component.files.find( + (file: { path: string; type: string; target: string }) => + file?.path?.endsWith(`${fileName}.tsx`) || + file?.path?.endsWith(`${fileName}.ts`) + )?.path ?? component.files[0]?.path : component.files[0]?.path }