aspnetcore-Vue-starter icon indicating copy to clipboard operation
aspnetcore-Vue-starter copied to clipboard

Proposal: Typescript support

Open YuriiNskyi opened this issue 7 years ago • 10 comments

Are there any plans for Typescript support? It would be great, to have static type checking, while working on complex projects with this template.

YuriiNskyi avatar Nov 07 '17 23:11 YuriiNskyi

Hey there, so Steve Sanderson from the ASPNet team has actually taken this exact project here and added TypeScript to it. 🎁

https://github.com/aspnet/templating/tree/dev/src/Microsoft.AspNetCore.SpaTemplates/content/Vue-CSharp

The goal here was to keep it in ES6+ for the time being, especially since TypeScript hasn't been fully adopted by the Vue community yet.

Me personally, I only use TypeScript :)

MarkPieszak avatar Dec 22 '17 17:12 MarkPieszak

I saw that project, the problem in it, is dividing Vue components into multiple files, so e.g. Vetur, doesn't handle this situation. So, I want best solutions, from both the projects.

YuriiNskyi avatar Dec 23 '17 20:12 YuriiNskyi

Here is an example where TypeScript is very well integrated to Single File Components: https://github.com/DanielRosenwasser/typescript-vue-todomvc

The tutorial for integrating TypeScript into Vue by the same author: https://github.com/DanielRosenwasser/typescript-vue-tutorial

vipetrul avatar Dec 23 '17 21:12 vipetrul

Here is an example how current template could be integrated with TypeScript: https://github.com/vipetrul/aspnetcore-Vue-starter/tree/type-script-support

Things to do:

  • git-ignore js files that were generated by ts
  • I was not able to augment $http service, VS Code still doesn't recognize it

I hope you will find this example useful.

vipetrul avatar Dec 27 '17 03:12 vipetrul

Hi, I have been trying to find a way to, using Visual Studio 2017, Vue 2.x, .Net Core 2.1 and TypeScript to be able to have a NON-SPA type application. Meaning each View (or Razor Page) would have a script tag to load its own transpiled .js file. If it has to also load Vue.js, that is fine. If it gets merged into the MyPage1.js and MyPage2.js then that is fine as well.

Seems like most out there are geared towards SPA but that is overkill for this project. Just trying to find the simplest way to use ES6 coding in TypeScript but having it be able to work in IE 11 (project requirement.)

Thanks in advance.

Grandizer avatar May 15 '18 19:05 Grandizer

@Grandizer , in webpack.config.js there a line entry: { 'main': './ClientApp/boot-app.js' }, You can add more entries for each root page, which will produce a separate <pageName>.js file which then can be manually referenced in each razor page.

vipetrul avatar May 15 '18 19:05 vipetrul

+1 for support for Typescript. I'm running into several errors when trying to implement it. @vipetrul thanks for including a fork with Typescript, although I'd also like the updates in this project that happened since you forked it.

baloodevil avatar Dec 06 '18 22:12 baloodevil

Yes I believe once I can get things updated to utilize the CLI, I'll release both ES2015 & TypeScript versions of the template to Nuget 👍 Hopefully in time for Christmas 🎄 🎅

MarkPieszak avatar Dec 08 '18 18:12 MarkPieszak

@MarkPieszak Really curious about TS support. Wondering if there has been any updates. Thanks!

giulianob avatar Apr 09 '19 03:04 giulianob

Apologies on the delay a lot of things happening lately :)

With Vue 3.0 coming out soon I think it's finally a great time to start working on this and getting this out! I'll post here when I have a working branch that hopefully everyone can test locally as well to make sure it works perfectly!

MarkPieszak avatar Apr 19 '19 19:04 MarkPieszak