phindle / error-lens

Visual Studio Code extension which enhances the display of errors and warnings.
https://marketplace.visualstudio.com/items?itemName=PhilHindle.errorlens
MIT License
89 stars 40 forks source link

False Typescript errors in .ts file when opening both .ts and respective .js file side by side #48

Open walidsi opened 1 year ago

walidsi commented 1 year ago

When having both a .ts file and the respective .js file both open in VSCode, you get a "Cannot re-declare block-scoped variable" error messages which disappears once you close the .js file.

Steps to reproduce:

1- Create a hello.ts file with the following code:

const msg: string = "Hello Typescript World!";
console.log(msg);
let id: number = 5
id = '5'

2- Save it and compile it with Typescript compiler. The file should have one Type 'string' error

3- Open the generated hello.js file

4- Switch back to the hello.ts file and notice the two additional "Cannot re-declare block-scoped variable" errors.

5- Close the hello.js file and notice the two errors are gone.

Expected behavior: