question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Couldn't resolve `'types' can only be used in a .ts file. Vetur(8010)`

See original GitHub issue
  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: macOS
  • Vetur version: 0.21.1
  • VS Code version: 1.35.1

Problem

I tried to use Vetur in my project of TypeScript with Nuxt.js. Then, 'types' can only be used in a .ts file. Vetur(8010) appeared.

vetur-with-nuxt-2019-7-4-1

However, I found this message didn’t appear when I tried to use Vetur in a project of TypeScript with Vue CLI.

Would you show me how deal with that message when using Vetur in TypeScript with Nuxt.js?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

52reactions
ktsncommented, Aug 1, 2019

It shouldn’t be appeared if the block is lang="ts". Can you provide a self-contained repro? (pasting .vue file, providing example github repo etc.)

24reactions
tbenyoncommented, Mar 22, 2020

My solution was to:

  • Ensure I had lang="ts" as an attribute in my script tag (as described above)
  • Restart VS Code
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: 'types' can only be used in a .ts file - Visual Studio ...
I'm using flow with vscode but had the same problem. I solved it with these steps: Install the extension Flow Language Support.
Read more >
Veturで"Type annotations can only be used in TypeScript ...
Couldn't resolve 'types' can only be used in a .ts file. Vetur(8010) #1347. Register as a new user and use Qiita more conveniently....
Read more >
how to solve Type annotations can only be used in TypeScript
This video is a solution for a problem caused in react native and react TypeScript. This problem generally occurs while creating ...
Read more >
Fixed:Type annotations can only be used in TypeScript files ...
Fixed: Type annotations can only be used in TypeScript files ( 8010 ) on React-Native App.js (VSCode). Watch later. Share. Copy link.
Read more >
'import … =' can only be used in TypeScript files |Declaration
'import … =' can only be used in TypeScript files | Unexpected keyword or identifier |Declaration expected solved in visual studio code ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found