dree icon indicating copy to clipboard operation
dree copied to clipboard

fix: make the return type of scan function nullable

Open mikavilpas opened this issue 11 months ago • 3 comments

Issue

Looking at the return type of scan(), it is not nullable, which hints at it throwing an error. However, in practice it does not throw an error and returns null when the path does not exist.

Solution

Make the return type of scan() nullable to indicate that the caller should check if it succeeded.

mikavilpas avatar Feb 15 '25 15:02 mikavilpas

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dree ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 15, 2025 3:48pm
dree-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 15, 2025 3:48pm

vercel[bot] avatar Feb 15 '25 15:02 vercel[bot]

This is a very minimal change - a lot of type errors are currently hidden. To see all of these errors, this change can be applied to see them:

diff --git a/tsconfig.json b/tsconfig.json
index d8b18b7..7d5dced 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -8,6 +8,7 @@
       "DOM"
     ],
     "sourceMap": true,
+    "strict": true,
     "declaration": true,
     "skipDefaultLibCheck": true,
     "skipLibCheck": true,
@@ -17,4 +18,4 @@
     "source",
     "scripts"
   ]
-}
\ No newline at end of file
+}

And then running pnpm tsc --noEmit in the root directory shows 68 errors. I'm not sure what the goals are so I won't try to fix them, unless you agree it would be a good change, and would accept a PR for it.

mikavilpas avatar Feb 15 '25 15:02 mikavilpas

@euberdeveloper what do you think?

mikavilpas avatar Mar 16 '25 06:03 mikavilpas