itsfrank / vue-typescript

Typescript decorators to make vue feel more typescripty
MIT License
358 stars 25 forks source link

Inconsistent `new` behaviour #2

Closed itsfrank closed 7 years ago

itsfrank commented 7 years ago

In the current implementation, calling new MyComponent() will return a Vue constructor instead of a vue component instance. This is forcing the use of new when assigning components to routes with vue-router (inconsistent with the vue-router documentation).

The fix is done, however this is very small breaking change for current users. Due to this, i have pushed it to the dev branch and published it to npm with the 'dev' tag. To use it point your package.json to version '^0.5.0' of vue-typescript. It will be merged with the master in the next release in a few days.

To upgrade your current projects, simply change component: new MyComponent() to component: MyComponent in your vue-router route definitions (or anywhere new was used with a component class)