chore: clean up TS warnings in search index & file finder (#18426)

This commit is contained in:
lipperhey
2025-09-13 14:54:02 +03:00
committed by GitHub
parent 33c75e8e52
commit 1bd6cc21c2

View File

@@ -14,6 +14,7 @@ async function fixSearchIndex() {
if (!searchIndexFile) {
console.error('❌ No search index file found in .vocs directory');
process.exit(1);
return;
}
console.log(`📁 Found search index: ${searchIndexFile}`);
@@ -55,7 +56,7 @@ async function fixSearchIndex() {
}
async function findFiles(dir: string, extension: string, files: string[] = []): Promise<string[]> {
const { readdir, stat } = await import('fs/promises');
const { readdir } = await import('fs/promises');
const entries = await readdir(dir, { withFileTypes: true });
for (const entry of entries) {
@@ -65,7 +66,7 @@ async function findFiles(dir: string, extension: string, files: string[] = []):
if (entry.name === '.vocs' || entry.name === 'docs' || entry.name === '_site') continue;
if (entry.isDirectory()) {
await findFiles(fullPath, extension, files);
files = await findFiles(fullPath, extension, files);
} else if (entry.name.endsWith(extension)) {
files.push(fullPath);
}
@@ -75,4 +76,4 @@ async function findFiles(dir: string, extension: string, files: string[] = []):
}
// Run the fix
fixSearchIndex().catch(console.error);
fixSearchIndex().catch(console.error);