hotwired / stimulus

A modest JavaScript framework for the HTML you already have

Home Page:https://stimulus.hotwired.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Intrepidd opened this issue · 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