Skip to content

vue-tsc doesn’t pick up types for external Vue modules when used in Options API #5710

@niksy

Description

@niksy

Vue - Official extension or vue-tsc version

vue-tsc 3.0.0

VSCode version

StackBlitz

Vue version

3.5.22

TypeScript version

5.9.3

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 20.19.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm

package.json dependencies

{
  "dependencies": {
    "pinia": "^3.0.3",
    "typescript": "^5.9.3",
    "vue": "^3.5.22",
    "vue-router": "^4.5.1",
    "vue-tsc": "^3.0.0"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^6.0.1",
    "vite": "^7.1.9"
  }
}

Steps to reproduce

What is expected?

Typechecking should only report missing type for this.bar.

this.foo is defined as computed property on current component, and this.$router and this.$pinia come from external package types.

What is actually happening?

Typechecking reports missing type for properties that should exist on current component instance.

Link to minimal reproduction

https://stackblitz.com/edit/vue-tsc-no-types-bug?file=src%2FApp.vue&terminal=dev

Any additional comments?

vue-router and pinia both have type definitions which should be used for Options API components

You can check them at the bottom of each file:

It seems like those types are not picked by vue-tsc and also by Vue language server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions