type checking of client code
Hi there. I'm testing out wasp via open saas and it looks promising! I'm noticing though, when I deliberately introduce a type error in client code, I don't see a compile failure in the terminal where I'm running my app. This is different from the server, where introducing a type error does cause a compiler error in the terminal. Can anyone help me find what I'm doing wrong?
5 Replies
We are using Vite for the client app and their default config - without TSC -> that's why you don't see type errors for the client.
For the server code, we are using TSC which watches your files and recompiles them on changes -> that's why you see type errors for the server.
Read more about Vite's reasoning for not doing type checking here: https://vitejs.dev/guide/features.html#transpile-only
It boils down to: your IDE will tell you about the type errors, and you'll find out about them when you try building the app if your IDE missed them π
This is one of many optimizations that make Vite fast.
Are you using VS Code for development? Does it show you type errors?
i use vim with no plugins
it's kind of important to me to be able to rely on the build process to do typechecking
i don't want to rely on my editor for more than editing code
what would my workflow look like if i want a second terminal to watch the entire codebase for changes and typecheck all of it?
@Filip @martinsos might be able to help more with that kind of setup π
π
Hey @beezee4037 ! I get what you are looking for, as I am on emacs, and my brother is on vim, and it is nice knowing that I have something in terminal that works for me even if I don't have full support in editor.
That said, I actually have typescript set up in emacs so I haven't tried getting TS error for the frontend/client in terminal for Wasp.
Checking Vite's docs here https://vitejs.dev/guide/features.html#typescript, I see that they recommend to use a separate tool for typechecking in parallel with Vite, and they mention
tsc --noEmit --watch
. So maybe trying that could give you wanted results?