1

Closed

Error highlighting in 0.9.1 is flakey

description

When editing .ts files in VS 2012 Update 3 with TS 0.9.1.0, the following lines of invalid typescript appears to be valid in the TS editor:

Image

To repro this problem type a line of invalid JS like "x = 10 + L" and when the intellisense popup appears after pressing "L", wait for a few seconds (the red squiggly marks disappear) then press ESC to dismiss the intellisense popup. Now, the line will appear valid. If you save the file at this point, invalid JS gets compiled and output.

Sometimes tinkering with the code and/or interacting with the editor fixes the issue, displaying the expected error highlighting but the JS that is compiled when you save is still invalid:

Image

This seems to happen a lot with a large TS project. I don't understand why TS is allowing invalid JS to be output. In the past when I used Web Essentials to compile the TS it would simply display a list of errors that needed to be corrected instead of invalid JS.

This problem makes it impossible to trust the error highlighting in the VS 2012 Plug-In with TS 0.9.1 and that the TS compiler is generating valid JS. This is a major pain point.

I have Web Essentials installed but I have turned off its compile on save and preview window features in an attempt to just use the TS Plug-In's built-in capabilities.
Closed Aug 22, 2013 at 9:03 PM by danquirk
With the latest bits I can't reproduce the error you're seeing in the sequence above. I always get the correct errors on the lines where I expect to. If you have other repros please re-open with them. We're aware of some issues in this space which we have fixed and with more to come.

The Typescript compiler intentional still emits JavaScript when there are type errors in your code (ie they are treated as warnings, not errors), but not when there are syntax errors. This is intentional to aid with the migration from and interop with JavaScript. We may eventually provide a means to do something like 'treat warnings as errors' so that you won't get emit when type errors exist.

comments

RWHepburn wrote Aug 22, 2013 at 5:56 AM

This issue seems to be resolved in the 0.9.1.1 release.

ursuletzu wrote Aug 22, 2013 at 10:38 AM

the flakey error problems are not resolved in the develop branch either.

RWHepburn wrote Aug 22, 2013 at 9:20 PM

Makes sense. Keep up the great work and thanks for being so responsive!