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

"Feature can only be used in a .ts file." when switching the language mode to TypeScript in a .js file #9199

Closed
niieani opened this issue Jul 13, 2016 · 2 comments
Assignees
Labels
typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@niieani
Copy link

niieani commented Jul 13, 2016

  • VSCode Version: all versions, tested also on latest: 1.4.0-insider 50a0945
  • OS Version: OS X 10.11

Steps to Reproduce:

  1. Create a TypeScript file with a .js extension
  2. Change the language mode inside VSCode to "TypeScript" (defaults to JavaScript in files with a .js extension)
  3. Add some TypeScript specific code, e.g. interface ABC {}

Causes an error:

'interface declarations' can only be used in a .ts file.

Mentioned in the discussion here: microsoft/TypeScript#7926

@niieani niieani changed the title "can only be used in a .ts file." "Feature can only be used in a .ts file." when switching the language mode to TypeScript in a .js file Jul 13, 2016
@dbaeumer dbaeumer removed their assignment Jul 13, 2016
@dbaeumer
Copy link
Member

This is a problem with the TSServer that infers the language mode from the extension. There are discussion to make the customizable.

Moving to TS team.

@dbaeumer
Copy link
Member

This issue was moved to microsoft/TypeScript#9670

@dbaeumer dbaeumer added upstream Issue identified as 'upstream' component related (exists outside of VS Code) typescript Typescript support issues labels Jul 13, 2016
@dbaeumer dbaeumer self-assigned this Jul 13, 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
typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

2 participants