Skip to content

Commit

Permalink
Add types for the function
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamedsalem401 committed Nov 27, 2023
1 parent 0017067 commit aab3fbc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/markdowndb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export class MarkdownDB {
}
}

function writeJsonToFile(filePath, jsonData) {
function writeJsonToFile(filePath: string, jsonData: any[]) {

Check warning on line 197 in src/lib/markdowndb.ts

View workflow job for this annotation

GitHub Actions / Lint & format check

Unexpected any. Specify a different type
try {
const directory = path.dirname(filePath);
if (!fs.existsSync(directory)) {
Expand All @@ -203,7 +203,7 @@ function writeJsonToFile(filePath, jsonData) {

const jsonString = JSON.stringify(jsonData, null, 2);
fs.writeFileSync(filePath, jsonString);
} catch (error) {
console.error(`Error writing data to ${filePath}: ${error.message}`);
} catch (error: any) {

Check warning on line 206 in src/lib/markdowndb.ts

View workflow job for this annotation

GitHub Actions / Lint & format check

Unexpected any. Specify a different type
console.error(`Error writing data to ${filePath}: ${error}`);
}
}

0 comments on commit aab3fbc

Please sign in to comment.