Skip to content
Latchkey

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" />
                    ~~~

Diagnose it: config resolution and version drift

Lint failures that appear only in CI are almost always a different linter version or a different resolved configuration, not new violations in the code.

Terminal
npx eslint --version
npx eslint --print-config path/to/file.ts | head -40
npx eslint --debug path/to/file.ts 2>&1 | grep -i "config" | head

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

  1. Pass a value of the declared type, or correct the prop type.
User.vue
<UserCard :age="user.age" />

Run vue-tsc locally

  1. Add a typecheck script and run it before pushing.
Terminal
vue-tsc --noEmit

How to prevent it

  • Run vue-tsc --noEmit locally and in a pre-push hook.
  • Type component props explicitly so mismatches are caught.

Frequently asked questions

What causes Vue "vue-tsc" type error?
There are 2 common causes: type checking only runs in ci and prop/binding type mismatch. Local dev skips type checking, so a mismatch sits unnoticed until vue-tsc runs.
How do I fix Vue "vue-tsc" type error?
There are 2 fixes depending on which cause you have: fix the type at the binding and run vue-tsc locally. Work through them in order, since the first is the most common.
What does Vue "vue-tsc" type error actually mean?
The typecheck step fails with a TSxxxx error inside a .vue file, often a prop or template binding type mismatch.
How do I stop Vue "vue-tsc" type error happening again?
Run vue-tsc --noEmit locally and in a pre-push hook. The prevention section lists 2 changes that keep it from recurring.

Related guides

References

Not every red build is your code. Latchkey repairs the ones that are not, on the runner. Start free → 30-day trial · No credit card