-
Notifications
You must be signed in to change notification settings - Fork 434
Typescript Errors in Visual Studio but project compiles and runs #197
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
Comments
Probably it's visual studio's issue. Can you compile it in webpack and tsloader? |
I can compile with webpack. It builds the main.js and vendor files. But on Visual studio, every ts file has an error like this at Component and Vue. |
@prindacerk Can you try it in vscode? |
I don't have Visual Studio Code installed in this PC. I will test it when I go home where I can access my laptop. |
I don't know if this is relevant or not. I also can't compile webpack if I use the Task Runner Explorer to execute the webpack run method. Following is the response when I run webpack using TRE.
|
The funny thing is, both these issues don't exist in the original SPA Template with the following package versions.
The Task Runner Explorer executes without any problem and the TypeScript doesn't show any errors and it runs fine. |
@ktsn it has already been off topic. I'm sure this is visual studio configuration issue. |
@HerringtonDarkholme So should I contact Visual Studio support regarding this? Is that Task Runner Explorer build error caused by VS or Webpack or Typescript or VueJs? |
This looks not related with vue-class-component. |
@ktsn Apologies. I didn't realize there's a forum and community chat. Will follow up on this in there and see. I do think it has something to do with Visual Studio and Typescript but it is only having this problem on Vue.js project. Angular project on Typescript is working fine. So that's why I thought to reach out here and see before I ask others. |
@prindacerk We are having the issue as well. Did you find out what the issue was? Interestingly it does not seem to happen in VS Code. VS has typically been pretty solid on the TS definition issues. My experience has been that if VS says somethings screwy with your typescript def, then it's probably right. @ktsn The update to vue, not VS brought this about, so not sure how you logic out that it's not a vue problem. Suspect your own stuff first. |
@dgwaldo I reported to Visual Studio and they said nothing was wrong with VS. I updated to the latest version as well. However, the javascript errors in my screenshot disappeared after I installed/updated the extensions they have for TypeScript in Visual Studio and Vue.js. I think I installed these extensions.
After installing them, Visual Studio recognized the code and didn't show it as an error anymore. I am still stuck on the WebPack compile using Task Runner Explorer. That still throws an error with these versions. I don't have a solution for that yet. |
What is the solution for this? Using .NET core 2 template dotnet new vue I get VS2017 errors out of the box but it actually does run fine and work (even debugging) in the files that contain the "errors", e.g. in counter.ts tells me it can't find the modules 'vue' and '-vue-property-decorator' on the 2 import statements and then for the @component tag it says "not assignable to type VueClass", plesae help |
Same problem here with Visual Studio Code. |
Has anyone find a solution for this? Installing vue pack and typescript sdk didn't help like @prindacerk mentioned |
Visual Studio SPA Templates has officially removed Vue from it's listing now. They are focusing on Angular. If you want, try this repository and see if it builds in your PC. This is my Vue.Js template for ASP.NET Core on latest version. Please let me know if it is not working. If not, then reason. If it works, check what is different in your project to cause the issue. Mainly the package versions. |
I couldnt find a typescript build extension. The only typescript extension i found just installs typeacript sdk.
As for the template being removed. Do you know why? I could still install and use it. It works without errors during runtime. But visual studio just gives the errors mentioned. I couldnt find a way fix the errors. But is still works.
|
@ahmettahasakar Typescript Build is not an extension. I apologize. I meant in the Project Properties, there's a tab called "Typescript Build". And make sure the Typescript version matches the version selected. Or select "Use Latest available" which will automatically use tsconfig.json. As for why they removed the Template, it's because they couldn't maintain it as their resource is limited. You can read about it here and the discussion about it here Try downloading the project in the repository I gave before. And see if it is showing any errors or not. |
I am a beginner learning Vue with .NET Core environment. I created a project using SPA Templates and it runs fine. But it comes preset with older Vue and other components. So I updated my packages. There were some tweaks I had to do to get it working but it works fine now.
You can see the repository here. https://github.com/prindacerk/corevue
Eventhough the project compiles and runs, in Visual Studio, there are Typescript errors for all the .ts files. It won't prevent the compilation but the error shows in all the files. I googled and came across this one. But this issue is reported to be fixed on 2.5.3. #181
But as shown in the screenshot, it still shows in 2.5.8.

Please let me know why it is happening and how to fix it.
The text was updated successfully, but these errors were encountered: