TrilonIO / aspnetcore-Vue-starter

*NEW* Asp.net Core & Vue.js (ES6) SPA Starter kit - Vuex, webpack, Web API, Docker, and more! By @TrilonIO
https://www.trilon.io
MIT License
1.22k stars 266 forks source link

Proposal: Typescript support #63

Open YuriiNskyi opened 6 years ago

YuriiNskyi commented 6 years ago

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

MarkPieszak commented 6 years ago

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 :)

YuriiNskyi commented 6 years ago

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.

vipetrul commented 6 years ago

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 commented 6 years ago

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:

I hope you will find this example useful.

Grandizer commented 6 years ago

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.

vipetrul commented 6 years ago

@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 .js file which then can be manually referenced in each razor page.

baloodevil commented 5 years ago

+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.

MarkPieszak commented 5 years ago

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 🎄 🎅

giulianob commented 5 years ago

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

MarkPieszak commented 5 years ago

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!