Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
walidsi opened this issue Oct 6, 2022 · 0 comments

Comments

@walidsi
Copy link

walidsi commented Oct 6, 2022

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:

  • No "Cannot re-declare block-scoped variable" errors should be raised.
@walidsi walidsi changed the title False Errors in .ts files when opening both .ts and respective .js file side by side False Errors in .ts file when opening both .ts and respective .js file side by side Oct 6, 2022
@walidsi walidsi changed the title False Errors in .ts file when opening both .ts and respective .js file side by side False Typescript errors in .ts file when opening both .ts and respective .js file side by side Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant