johnsoncodehk / vue-tsc

vue-tsc --noEmit && vite build
https://www.npmjs.com/package/vue-tsc
MIT License
241 stars 6 forks source link

Error on radio input #55

Closed sheremet-va closed 3 years ago

sheremet-va commented 3 years ago

vue-tsc version: 0.2.2

I have this input (radio reference: https://v3.vuejs.org/guide/forms.html#radio):

  <input
      :id="option[valueField]"
      v-model="inner"
      class="radio"
      type="radio"
      :disabled="disabled"
      :name="name"
      :value="option[valueField]"
  />

But running vue-tsc gives me this error:

Снимок экрана 2021-08-10 в 11 24 57

Volar doesn't give me this error. I guess it thinks value from v-model conflicts with value?

If I remove :value="option[valueField]" component breaks.

Shinigami92 commented 3 years ago

I had this issue too and solved it by (in your case) set the correct default for inner

So I assume you have e.g.

const inner = ref(option[valueField])

// Or lazy init

const inner = ref()
// vvv Or somewhere else
onBeforeMount(() => {
  inner.value = option[valueField]
})
sheremet-va commented 3 years ago

My inner is computed for props.modelValue that emits update (like useVModel in vueuse)

But thanks for your help, I will try to bypass this error.