From 4c1946b0ad3e35918a2e7aff011c82a48de765a0 Mon Sep 17 00:00:00 2001 From: Abdellah Hariti Date: Tue, 27 Feb 2024 19:54:41 +0100 Subject: [PATCH] add some missing types --- src/files.js | 3 +++ src/mdx.ts | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/files.js b/src/files.js index e64abeae44080..39f7ce27a49d2 100644 --- a/src/files.js +++ b/src/files.js @@ -17,6 +17,9 @@ const walkDir = fullPath => { const pathJoinPrefix = prefix => extraPath => path.join(prefix, extraPath); +/** + * @returns {string[]} - Array of file paths + **/ const getAllFilesRecursively = folder => pipe(fs.readdirSync, map(pipe(pathJoinPrefix(folder), walkDir)), flattenArray)(folder); diff --git a/src/mdx.ts b/src/mdx.ts index bc2bca8dbca95..0883e36a91c87 100644 --- a/src/mdx.ts +++ b/src/mdx.ts @@ -26,7 +26,7 @@ import remarkVariables from './remark-variables'; const root = process.cwd(); -function formatSlug(slug) { +function formatSlug(slug: string) { return slug.replace(/\.(mdx|md)/, ''); } const isSupported = ( @@ -205,7 +205,7 @@ export function getAllFilesFrontMatter(folder: string = 'docs'): FrontMatter[] { return allFrontMatter; } -export async function getFileBySlug(slug) { +export async function getFileBySlug(slug: string) { const configPath = path.join(root, slug, 'config.yml'); let configFrontmatter: {[key: string]: any} | undefined; if (fs.existsSync(configPath)) {