vue-typescript icon indicating copy to clipboard operation
vue-typescript copied to clipboard

typescript 2.0

Open davidmoshal opened this issue 8 years ago • 19 comments

Hi, have been using vue-typescript with:

  • Typescipt 1.8.10 and
  • vue 1.26 works great!!

So, am wondering if I can expect any issues upgrading to Typescript 2.0?

Thanks again for the awesome work on this project.

davidmoshal avatar Sep 17 '16 21:09 davidmoshal

How about Typescript 2.0 and Vue 2.0? Any issues?

davidmoshal avatar Oct 09 '16 22:10 davidmoshal

So far it seems that vue-typescript:

  • does work with Typescript 2.0 but
  • does NOT work with Vue 2.0.

Seems like others have migrated to this project: https://github.com/vuejs/vue-class-component

however, that project seems to have less functionality, for example:

  • no @watch
  • no @prop({require:true})

So, for the moment I'm staying with vue-typescript, hopefully @itsFrank will weigh in on this.
Note: Vue 2.0 removes 2-way sync.

Generally I'm not a fan of two-way sync, however, consise idioms for replacing sync with emit seem lacking at this time.

davidmoshal avatar Oct 27 '16 00:10 davidmoshal

Hi, av-ts is also an option to try here. So sorry to mention my own library here. But I hope more libraries competition may keep projects going better.

HerringtonDarkholme avatar Oct 29 '16 05:10 HerringtonDarkholme

@Herrington would be great if you could describe a migration path, based on vue-typescripts readme.

davidmoshal avatar Oct 29 '16 06:10 davidmoshal

@HerringtonDarkholme - just came across this, was wondering what you think of it:

https://libraries.io/npm/vue-typescript-component

davidmoshal avatar Nov 01 '16 04:11 davidmoshal

@davidmoshal It might be more suitable for you because of its API resemblance to vue-typescript.

I don't want to brag here. So please refer to av-ts readme. I believe it has better extensibility and broader coverage.

HerringtonDarkholme avatar Nov 01 '16 05:11 HerringtonDarkholme

thanks, I moved the discussion to your repo, not fair to have it on @itsFrank 's site.

davidmoshal avatar Nov 01 '16 06:11 davidmoshal

Really wish you update this library, vue-class-component, and vue-property-decorator are such a mess. Actually I'm wondering if Vue 2.0 is worth the upgrade!

davidmoshal avatar Jan 09 '17 21:01 davidmoshal

I will, I've been overwhelmed with grad school applications for the pas few months, I will find time to get this library feature complete for vue 1 at least and look into the work needed for vue 2 compatibility

itsfrank avatar Jan 09 '17 21:01 itsfrank

Hopefully it should be updated by mid February

itsfrank avatar Jan 09 '17 21:01 itsfrank

Thanks!! Then I'll stick with vue-typescript and Vue 1 for now. Upgrading to Vue 2 isn't worth it if I have to drop typescript, and current typescript libraries aren't giving me the same functionality of vue-typescript.

Dave

davidmoshal avatar Jan 09 '17 21:01 davidmoshal

Vue 2 removing broadcast was a huge mistake in my opinion, I personally much prefer vue 1

itsfrank avatar Jan 09 '17 21:01 itsfrank

Not the only huge mistake, vue-class-component (official typescript library) requires property definition twice!.

And this example (using vue-class-component, and vue-property decorator):

import { Component, prop } from 'vue-property-decorator';
import * as Vue from 'vue';

@Component({
  template: `
      <div>
        <div>{{propA}}</div>
        <button @click="propA +=1 ">click</button>
      </div>
  `
}) export class One extends Vue{
    @prop({
      default: 0
    })
    propA: number   
}

results in a huge error message:

[Vue warn]: Avoid mutating a prop directly since the value will be overwritten 
whenever the parent component re-renders. Instead, use a data or computed 
property based on the prop's value. Prop being mutated: "propA" 

WTF - you can't mutate local variables, why?

I'm wondering if a typescript-specific fork of Vue1 (called Vuet) would be a good idea?

davidmoshal avatar Jan 09 '17 21:01 davidmoshal

@itsFrank I publishing a project showing how to test vue-typescript components with WallabyJS.

https://github.com/davidmoshal/reactive-vue-typescript-testing

I've decided to stick with Vue 1.x for the forseable future, several of the Vue 2.0 design decisions are questionable.

More interested to me would have been to evolve Vue to support TSX templates.

davidmoshal avatar Jan 13 '17 15:01 davidmoshal

Hey any news about the vue2 support?

galprz avatar Mar 22 '17 22:03 galprz

So Vue 2.0 I'm hoping to take a look at after my final exams / graduation so hopefully mid May.

I have been a terrible project manager for vue-typescript I'm well aware of that. I had to drop the project when it was gathering the most momentum because of school and the numerous commitments I had in the university context.

Currently, I'm finishing up my bachelor's so I am at the mercy of my midterms, project deadlines and final exams.

This is the current timeline for this repo:

  • Finalize all the features I said I would add to support Vue 1.0, and finally publish a v 1.0.0 of Vue-Typescript
  • Evaluate the work required to support Vue 2.0 and if it requires a completely new project or if this one can be adapted to work with it.

There are a few issues with me developing this repo though.

  1. I have very little time so I cant be working on this every day like I was able to last summer
  2. I do very little web development these days and will do even less over the next two years as I'll be pursuing a master's in computer engineering.

#2 is especially important because in order to properly develop and direct this project I need to be somewhat involved in the field, seeing as I no longer do webdev (in the shortterm at least) I am really "out of the loop" when it comes to trends and directions different frameworks are taking.

Honestly I have been hoping someone would have picked up this project and carried it forward but it doesn't look like anyone is going to do this.

I can however make 2 promises: I WILL make a feature complete release for Vue1.0 before june. I will evaluate the possibility of vue2.0 support.

I personally am not a huge fan of some of the decisions that went into vue 2,0 (specifically the inter-component communication changes like what they did with 2 way binding and such) So if I were to make a quick project I probably would stick to vue 1.0

This however isn't a reason to not support 2.0, but it is yet another item on the long list that makes it hard to motivate me to put in the work to make it happen.

I still believe vue-typescript is in a very "usable" state, and it gives me the structure angular 2 promised while keeping the lightweight of Vuejs

Hopefully this explains a bit about why this project has been in limbo since september. The day I get back into web-dev it might see a full revival but for now I will focus on making it completely usable with vue 1.0 and see if it is worth it to support vue 2.0.

itsfrank avatar Mar 22 '17 23:03 itsfrank

still the best way to use TS with Vue

  • we've held off on Vue 2.0 just to stay with vue-typescript!

Now that Webstorm 2017.1 has come out with support of Typescript in .vue files it's time to rethink.

Dave

davidmoshal avatar Mar 23 '17 00:03 davidmoshal

Yeah I saw that webstorm update, looks like it brings most of typescripts benefits to pure Vue 2.0. Very interesting.

itsfrank avatar Mar 23 '17 00:03 itsfrank

Seems like Vue 2.2 has made some changes to TS usage:

  • https://vuejs.org/v2/guide/typescript.html

I haven't tried this version, but prior attempts to use Vue 2's TS support, including using the various decorator addons, have resulted in a much poorer experience than Vue 1 + vue-typescript.

Note the advice re TS compiler settings. Interestingly we've found that we have to use BOTH TS transpiler & Babel transpiler.

This is because Webpack's tree shaking leaves ES6 'usused code' in the ES5 output of the TS transpiler, and the standard version of Uglify can't handle ES6.

So, you have to add in Babel ie: the pipeline is TS -> Babel -> Uglify

davidmoshal avatar Mar 23 '17 02:03 davidmoshal