Vue "vue-tsc" Type Error - Fix in CI
vue-tsc type-checks SFC scripts and templates. The dev server transpiles without type checking, so errors only appear when vue-tsc runs in CI.
What this error means
The typecheck step fails with a TSxxxx error inside a .vue file, often a prop or template binding type mismatch.
vue
src/components/User.vue:12:20 - error TS2322: Type 'string' is not
assignable to type 'number'.
12 <UserCard :age="user.name" />
~~~Common causes
Type checking only runs in CI
Local dev skips type checking, so a mismatch sits unnoticed until vue-tsc runs.
Prop/binding type mismatch
A template binds a value whose type does not match the declared prop.
How to fix it
Fix the type at the binding
- Pass a value of the declared type, or correct the prop type.
User.vue
<UserCard :age="user.age" />Run vue-tsc locally
- Add a typecheck script and run it before pushing.
Terminal
vue-tsc --noEmitHow to prevent it
- Run
vue-tsc --noEmitlocally and in a pre-push hook. - Type component props explicitly so mismatches are caught.
Frequently asked questions
What causes "vue-tsc error"?
Local dev skips type checking, so a mismatch sits unnoticed until vue-tsc runs.
How do I fix vue-tsc error?
Fix the type at the binding
Related guides
Vue "compiler-sfc" Error - Fix in CIFix Vue compiler-sfc errors in CI - a malformed Single File Component template/script, or a vue/compiler-sfc…
Vue "Failed to resolve component" - Fix in CIFix "Failed to resolve component" in CI - a component used in a template was never registered, imported, or h…
Next.js "Hydration failed" - Fix in CIFix "Hydration failed because the server rendered HTML did not match the client" in CI - non-deterministic re…