Skip to content

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

@walidsi

Description

@walidsi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions