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

TS2304: Cannot find name '<variables_exposed_in_setup>' reported after setting allowJs to true #780

Closed
0140454 opened this issue Dec 12, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@0140454
Copy link

0140454 commented Dec 12, 2021

Hi,

I have a Vue2 project, where components are written in JavaScript or TypeScript.

Without setting allowJs to true in tsconfig.json, there is a message Virtual script not found, ...

image

After I set allowJs to true in tsconfig.json, Virtual script not found messages in js .vue file have gone.
But in ts .vue file, TS2304 errors are reported by vue-tsc and VSCode.

image

Here is the repository for reproduction, and version information is as the following.

  • typescript v4.4.4
  • vue v2.6.14
  • vue-tsc v0.29.8
  • @vue/runtime-dom v3.2.25

Similar issue I found: #319

@0140454
Copy link
Author

0140454 commented Dec 13, 2021

Solved by using Vue.extend to wrap object exported in js .vue file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants