vuejs / vue-class-component

ES / TypeScript decorator for class-style Vue components.
MIT License
5.81k stars 429 forks source link

Add more decorators #96

Open ferrx opened 7 years ago

ferrx commented 7 years ago

Regarding vue-property-decorator at https://github.com/kaorun343/vue-property-decorator/blob/master/src/vue-property-decorator.ts -- why shouldn't vue-class-component handle this?

kaorun343 commented 7 years ago

Hi.

As described at #50 , vue-class-component supports Babel but vue-property-decorator doesn't support it.

ferrx commented 7 years ago

I see. The comment in #50 is very detailed and explains it thoroughly.

This is because Babel decorators will initialize a decorated property as undefined even if it does not have an initializer while TypeScript decorators won't initialize it.

I think any kind of work-around to add conflicting decorators would be convoluted unfortunately, so I would agree that this library should not mix them in. Another avenue would be to setup a library at /vuejs/vue-ts -- but even that could cause some code fragmentation eventually and make things less manageable (if the plan is to continue to support vue-class-component as well).

Mikilll94 commented 4 years ago

@ktsn Babel 7 changed decorators implementation. See this: https://github.com/kaorun343/vue-property-decorator/issues/26

So maybe this creates a possibility to add more decorators to this plugin?