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.

"Cannot find name" and other problems with TypeScript-SFC

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

Info

  • Platform: Win 10
  • Vetur version: 0.22.1
  • VS Code version: 1.37.0

Problem

Vetur underlines everything and gives errors like Cannot find name all the time.

Screenshot

Reproducible Case

At the moment I’m not sure how to make a reproducible case. The project is closed source and I’m not the author of most of the code. I mostly hope, that someone has seen this behaviour before.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:19
  • Comments:39 (8 by maintainers)

github_iconTop GitHub Comments

14reactions
KVINTHcommented, Aug 17, 2020

Just encountered this issue as well, same situation as @msamsel

Steps taken to address:

  1. renamed File.Vue to File.vue (did not work)
  2. created NewFile.vue and copied code from File.vue over
  3. deleted File.vue
  4. renamed NewFile.vue to File.vue
14reactions
msamselcommented, Aug 29, 2020

@ktsn I hope this description will help you track down the error.

Same issue here. The way how I was able to make such error. VSCode: version: 1.47.1 Vetur: 0.24.0 MacOS: 10.15.5

  1. Open VSCode and create new file with button in on left file tree: Screenshot 2020-07-16 at 13 05 51
  2. Name file with anything.Vue important part is to start extension with a capital letter.
  3. VSCode will start to produce single error on the closing character of </template> tag: Screenshot 2020-07-16 at 13 03 14
  4. Rename file (inside VSCode) to small later extension anything.vue
  5. Fully close and open VSCode again
  6. Open file with small letter extension. Screenshot 2020-07-16 at 13 03 57
  7. Please notice that Vetur error still see file as test.Vue not test.vue as it is an actual name of the file. It looks like something somewhere is cached.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript - "Cannot find name" errors in React components
I am migrating my existing React code over to TypeScript and I am hitting a lot of issues, one of them being a...
Read more >
TypeScript errors and how to fix them
Common Errors. Below you find a list of common TypeScript errors along with the buggy code and its fixed version.
Read more >
semantic error TS2304: Cannot find name 'react' (TypeScript ...
tsx(4,11): semantic error TS2304: Cannot find name 'react'. I am using yarn workspaces .
Read more >
Using TypeScript - React Native
Getting Started with TypeScript​ ... If you're starting a new project, there are a few different ways to get started. ... If the...
Read more >
Function Components - React TypeScript Cheatsheets
Declaring type of props - see "Typing Component Props" for more examples ... return type so an error is raised if you accidentally...
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