Vue warns that v-model passed the wrong type to modelValue
Your error
[Vue warn]: Invalid prop: type check failed for prop "modelValue". Expected String with value "5", got Number with value 5.2 more lines it can showFix it fast
Most common cause, 1 of 3The parent binds a number where the child declares String (or the reverse)
Decide which type the component really works with.
// Child.vue: accept both forms
const model = defineModel({ type: [String, Number] })
// or keep String and convert where the data arrives
form.value.quantity = String(apiResponse.quantity)Short answer
Vue warns Invalid prop: type check failed for prop "modelValue" when the v-model value does not match the type the child declares. A number sent to a String model, an emptied .number input that yields "", or null sent to a required model all cause it. Convert the data or widen the prop type. Applies to Vue 3.5.
Which cause do you have?
The warning already names both sides: Expected is the type the child declares, got is the runtime type of the value the parent bound. Find the declaration in the child to see whether it is a runtime type, a TypeScript type or a defineModel option.
grep -rn -E "modelValue|defineModel" src --include=*.vue | grep -v "update:modelValue"Then find the line you see in this list and open its fix:
- 1The parent binds a number where the child declares String (or the reverse)
The message reads Expected String with value "5", got Number with value 5, or the mirror image - 2An emptied .number input turns the value back into an empty string
Expected Number with value 0, got String with value "" appears right after the user clears a number field - 3null reaches a model that is required, often through a TypeScript type
The message says got Null, and the child uses defineProps<{ modelValue: string }>() or required: true
What does the error look like?
[Vue warn]: Invalid prop: type check failed for prop "modelValue". Expected String with value "5", got Number with value 5.[Vue warn]: Invalid prop: type check failed for prop "modelValue". Expected Number with value 0, got String with value "".[Vue warn]: Invalid prop: type check failed for prop "modelValue". Expected Array, got String with value "red".
Cause 1 of 3
The parent binds a number where the child declares String (or the reverse)
You seeThe message reads Expected String with value "5", got Number with value 5, or the mirror image
Check
The modelValue type check failed because the child declared one primitive type and v-model delivered another. Numeric IDs from an API, a counter in the parent's state and inputs with type="number" all hand over numbers, since Vue applies the .number modifier on its own to number inputs.
grep -rn -E "type=\"number\"|v-model.number" src --include=*.vueFix
Decide which type the component really works with. Convert the value once where it enters the parent state, or, when both make sense, list both types in the declaration.
// Child.vue: accept both forms
const model = defineModel({ type: [String, Number] })
// or keep String and convert where the data arrives
form.value.quantity = String(apiResponse.quantity)Verify
Reload the page in development mode and type into the field. No Invalid prop warning appears in the console.
npm run devConfirmed by raw.githubusercontent.com
Cause 2 of 3
An emptied .number input turns the value back into an empty string
You seeExpected Number with value 0, got String with value "" appears right after the user clears a number field
Check
With the .number modifier, Vue only returns a number when parseFloat can read the text. After the user clears the field, the bound value becomes an empty string, and a child that declares Number for modelValue warns on that string.
grep -rn "v-model.number" src --include=*.vueFix
Normalise the empty string before it reaches the child, for example to null with an optional prop, or let the prop accept both Number and String and treat an empty string as no value.
// Parent: bind <input v-model.number="amountInput"> and pass amount to the child
const amount = ref(null)
const amountInput = computed({
get: () => amount.value,
set: (v) => { amount.value = v === '' ? null : v }
})
// Child: optional Number, so null skips the type check
const model = defineModel({ type: Number })Verify
Clear the field and type a number again. The console stays free of the String with value "" warning.
npm run devConfirmed by raw.githubusercontent.com
Cause 3 of 3
null reaches a model that is required, often through a TypeScript type
You seeThe message says got Null, and the child uses defineProps<{ modelValue: string }>() or required: true
Check
Vue skips the type check for null and undefined only on optional props. A TypeScript declaration such as defineProps<{ modelValue: string }>() compiles to a required String prop, so a parent ref that starts as null fails the check until real data arrives.
grep -rn -E "defineProps<|required: true" src --include=*.vueFix
If the component can render without a value, make the prop optional in its type. If it must stay required, add null to the allowed types, or give the parent ref a real starting value.
// optional: null and undefined skip the check
const props = defineProps<{ modelValue?: string | null }>()
// required but nullable, runtime declaration
const model = defineModel({ type: [String, null], required: true })Verify
The page loads with the empty starting value and the console shows no type check warning.
npm run devConfirmed by raw.githubusercontent.com
How do I stop it coming back?
- Give each form field one agreed type in the parent state, and convert API values to it in the data layer rather than inside templates.
- Declare modelValue with an explicit type in every reusable input component, including null when an empty state is valid.
- In component tests, set app.config.warnHandler to a function that throws, so a prop type warning fails the test run instead of scrolling past.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.