wasp icon indicating copy to clipboard operation
wasp copied to clipboard

Explicitly type-check user code during `wasp compile`

Open infomiho opened this issue 1 year ago • 0 comments

Edit by @sodic at 22.08.2024.

[!NOTE] Original title was Provide type-checking in development. I changed it because we should do this for both wasp start and wasp build.

We should explicitly run tsc --noEmit to type-check user files before attempting to build the SDK or the framework code (in both wasp start and wasp build).

We currently only check the user code implicitly when building other modules, which makes the error messages confusing and sometimes postponed until the build (thanks to bundling, see below).

To make things worse, the user code is currently implicitly type-checked and built in four different contexts, each with its own errors and reporting channels. This problem is already covered in #2247 and can be solved independently of this one.

Solving this issue will probably close #1664 (or close to it).

Original issue

After we switch to using a bundler for our server code (https://github.com/wasp-lang/wasp/pull/1714) we will stop using tsc and won't display type errors in the terminal anymore.

Some people prefer seeing the type errors in the terminal alongside their IDE (or they only check for type errors in their terminal instead of their IDE).

We can run tsc --noEmit alongside our bundler to output type errors. We could probably narrow it down only type checking user's code instead of the whole server or web app.

infomiho avatar Feb 06 '24 12:02 infomiho