Skip to content

Conversation

@mikavilpas
Copy link

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.

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.
@vercel
Copy link

vercel bot commented Feb 15, 2025

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

@mikavilpas
Copy link
Author

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 added a commit to mikavilpas/tui-sandbox that referenced this pull request Feb 15, 2025
#290)

* fix: build an empty schema when trying to scan a nonexistent directory

euberdeveloper/dree#51

* fixup! fix: build an empty schema when trying to scan a nonexistent directory
@mikavilpas
Copy link
Author

@euberdeveloper what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant