-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Describe the bug
InputText and DatePicker declare | undefined in their update:modelValue and value-change emit signatures, but neither component can emit undefined at runtime.
With strictTemplates: true in vue-tsc, the emitted | undefined is not assignable to the consumer's ref type (e.g., Ref<string> for InputText), producing 39 false-positive type errors.
InputText: Single emission path: onInput(event) -> writeValue(event.target.value). HTMLInputElement.value is always string per HTML spec. Full inheritance chain audited — no path can emit undefined.
DatePicker: All 9 emission paths traced through updateModel() -> writeValue() -> $emit(). Clear button emits null. Invalid text input throws (no emission). 7 edge cases pressure-tested. undefined is never passed to writeValue().
Related: #6041
PrimeVue version
4.5.4
Vue version
3.5.x
Language
TypeScript
Build / Runtime
Vite
Steps to reproduce the behavior
- Enable
strictTemplates: trueintsconfig.jsonundervueCompilerOptions - Use
<InputText v-model="myString" />wheremyStringisref<string>('') - Run
vue-tsc --noEmit - Observe:
Type 'string | undefined' is not assignable to type 'string'
Expected behavior
No type error — InputText always emits string, never undefined.