hotwired/stimulus

Value declared with a {type: String} but no default value behave like they have a default value

Intrepidd opened this issue · 0 comments

Consider the following values :

static values = {
  foo: {type: String},
  bar: String
}

If both values are un-set, the following will happen

this.hasFooValue // true
this.hasBarValue // false

Looks like it comes from here :

return this.data.has(key) || definition.hasCustomDefaultValue

get hasCustomDefaultValue() {
return parseValueTypeDefault(typeDefinition) !== undefined
},

This is beyond my knowledge but it looks like there is a mixup about what is passed to parseValueTypeDefault