Ionic serve is not showing any typescript errors on the console

#1

When I run ionic serve from my command prompt, and I have a typescript error, there is no indication from the build that anything is wrong. I would expect behavior similar to ng build --watch, which outlines any errors and where they are located.

Am I missing something that would give me these errors on the ionic serve?

1 Like
#2

Are you talking about the linter, or about compilation errors?

Edit: remember ngc uses a much newer version of Typescript than Ionic does. So ngc flags more errors and warnings in some code.

#3

Compilation errors.

Often times I find that if I quit the ionic serve and re-start it, the initial build process will pick up errors that the rebuild doesn’t.

I also find that sometimes I have to exit ionic serve just to pick up changes at all! It will load old pages until I restart.

#4

That’s intentional. The rebuild tries its best to make things work. If you want a cold restart, close ionic serve and the browser, and type ionic serve again.

#5

@AaronSterling Please please change this behaviour! The purpose of having typescript and a live reload server is to show type errors when I change the code. If I have to restart the live reload server to show typescript errors, what’s the point in having a live reload server? And, it is very unintuitive to not show the types of errors in the console. I saw lint errors in the console, so I assumed that I would see compilation errors as well. This had led me to waste annoying amounts of time.

#6

By the way, i am not the only one who has this concern https://github.com/ionic-team/ionic-app-scripts/issues/1355

#7

I’m not an Ionic dev. You’d be better served filing an issue on github.

#8

If they did what you want, there would then be a flood of whiners complaining that live reload takes too long to compile.

#9

Then the solution would be to explicitly disable printing compilation errors. Not printing out error messages that one would expect to be printed is a reasonably nasty behaviour especially when debugging