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

Files with .es6 suffix are treated as TypeScript files #5046

Closed
jbutz opened this issue Apr 6, 2016 · 2 comments
Closed

Files with .es6 suffix are treated as TypeScript files #5046

jbutz opened this issue Apr 6, 2016 · 2 comments
Assignees

Comments

@jbutz
Copy link

jbutz commented Apr 6, 2016

  • VSCode Version: 0.10.11
  • OS Version: OS X El Capitan v 10.11.4

Steps to Reproduce:

  1. Create a new file with the extension .es6 and the following code

    class Testing {
       constructor() {
           this.myValue = "Hello World";
       }
    
       test() {
           return this.myValue;
       }
    }
  2. The Language Mode is automatically set to "JavaScript", but on this.myValue you get Property 'myValue' does not exist on type 'Testing' errors.

  3. Close the file and rename it to use a .js extension

  4. Open the file and notice that the errors are gone

@egamma egamma changed the title Errors in ES6 JavaScript files with the extension .es6 Files with .es6 suffix are treated as TypeScript files Apr 7, 2016
@egamma
Copy link
Member

egamma commented Apr 7, 2016

What is happening is that VS Code registers .es6 files as JavaScript files and Code sends them over to the tsserver. Inside the tsserver .es6are not treated as JavaScript files but as TypeScript files. For this reason you get the additional errors.

One work around is to disable the error diagnostics from the tsserver for js files in the settings: "javascript.validate.enable": false. When you do so you should really setup eslint to get javascript diagnostics https://github.com/Microsoft/vscode-docs/blob/vnext/release-notes/vFebruary.md#linters.

Moving to TypeScript, there should be a way to configure that .es6 files need to be treated as JavaScript files. If VS Code doesn't send .es6 to the tsserver then the user doesn't get Intellisense and only coloring.

@egamma
Copy link
Member

egamma commented Apr 7, 2016

This issue was moved to microsoft/TypeScript#7926

@egamma egamma closed this as completed Apr 7, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants