#1718·wasp

Explicitly type-check user code during `wasp compile`

Author: infomihoCreated Feb 6, 2024Updated Sep 30, 2026
Labelsenhancementrestructuringregression

Another edit by @sodic at 25.09.2026.

Please add regression tests for this while you're at it:.

I imagined something like this
haskell
      TestCase
        "fail-on-missing-side-effect-import-in-client-code"
        ( sequence
            [ createTestWaspProject minimalStarterTemplate,
              inTestWaspProjectDir
                [ appendToFile "src/MainPage.tsx" missingSideEffectImport,
                  assertCommandOutputContains (return waspCliCompileFails) missingSideEffectImportError
                ]
            ]
        ),
      TestCase
        "fail-on-missing-side-effect-import-in-server-code"
        ( sequence
            [ createTestWaspProject minimalStarterTemplate,
              inTestWaspProjectDir
                [ replaceMainWaspTsFile mainWaspTsWithServerSetup,
                  writeServerSetupTs,
                  assertCommandOutputContains (return waspCliCompileFails) missingSideEffectImportError
                ]
            ]
        )

New edit by @FranjoMindek at 10.08.2026.

The blocker (#2247) is gone. Since #4049 and #4067, the compilation order is now: SDK → user project → client/server, with no cycle.

We should add an explicit user code type-check step, after the SDK build and before the client/server builds.

Sidenote: Does this affect our Vite typescriptCheck plugin?

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.