Typescript: Visual Studio 2017 is compiling JS file without associated TS file

Created on 23 Mar 2017  ·  7Comments  ·  Source: microsoft/TypeScript



TypeScript Version: 2.1.5

Code
Get master branch from here:
https://github.com/styfle/TypeScriptReproBug

Expected behavior:
Do not compile .js files if there is no matching .ts file.

Actual behavior:
The .js files are modified and a .js.map file is generated.

More Info

I opened an existing 2015 project in VS 2017, edited a .d.ts file, saved, and VS started compiling a lot of files....files that do not have a .ts associated with them 😨

image

Then I looked at git changes in Team Explorer tab and I can see that a bunch of .js files were modified and a bunch of .js.map files were added.

image

@billti Please review the code. Thanks!

Bug

Most helpful comment

Im on 2.3.3 and it is happening to me also

All 7 comments

Thanks. I just tried this and couldn't repro, then realized I was running TypeScript 2.2. Switching to 2.1 (that comes with VS 2017) I could repro.

If you could try using TypeScript 2.2 (as outlined in https://github.com/Microsoft/TypeScript/issues/14529#issuecomment-287517438 ) and confirm this fixes the issue, at least we'll know this is already addressed somehow (I couldn't spot the exact commit which would have fixed it).

I haven't got around to testing this but is there a new version of TypeScript going to be released with a 2017 update?

I just realized <TypeScriptToolsVersion/> is set to 1.8.

I went ahead and tried to reproduce with the latest Visual Studio released May 10, 2017 - version 15.2 (26430.04).

Without any changes to <TypeScriptToolsVersion/> the bug is still present, however changing <TypeScriptToolsVersion/> to 2.2 fixes the bug.

Thanks for confirming it's fixed in the latest release.

@billti I just had this happen to me again today. I am using Version 15.2 (26430.6) now.

Is this supposed to be fixed with selecting TypeScript 2.1 or only in 2.2?

Im on 2.3.3 and it is happening to me also

Was this page helpful?
0 / 5 - 0 ratings