vue-property-decorator icon indicating copy to clipboard operation
vue-property-decorator copied to clipboard

Property with no value doesn't imply true, using decorator without type.

Open bychung opened this issue 4 years ago • 2 comments

Describe the bug For the Vue components property, no-value property imply true. (https://vuejs.org/v2/guide/components-props.html#Passing-a-Boolean) But without type definition of Prop Decorator, it can't be worked. Below is the example.

Template :

<my-template editable>

Component (maybe bug) :

@Prop() editable!: boolean;

=> editable is false.

Component (works well) :

@Prop(Boolean) editable!: boolean;

=> editable is true!

Of course, included 'reflect-metadata' and set emitDecoratorMetadata to true.

bychung avatar Oct 05 '20 08:10 bychung

I also would consider it as a bug @Prop(Boolean) editable!: boolean; is redundant and doesn't really fit to the whole purpose of the decorators.

I will try to create a fix for it. Is there anyone who has a suggestion for the solution?

azollai avatar May 03 '21 14:05 azollai

https://github.com/kaorun343/vue-property-decorator#if-youd-like-to-set-type-property-of-each-prop-value-from-its-type-definition-you-can-use-reflect-metadata

CostaIsNotAvailable avatar Dec 13 '21 09:12 CostaIsNotAvailable