Skip to content

Issues with globally augmented types of packages in vue files #5644

@AlansCodeLog

Description

@AlansCodeLog

Vue - Official extension or vue-tsc version

3.0.7

VSCode version

do not use, use neovim with vue-tsc as plugin of vstls

Vue version

3.5.21

TypeScript version

5.9.2

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

package.json dependencies

{
  "name": "vite-vue-starter",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "@tiptap/core": "^3.4.2",
    "vue": "^3.5.21"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^6.0.1",
    "typescript": "^5.9.2",
    "vite": "^7.1.4",
    "vue-tsc": "^3.0.7"
  }
}

Steps to reproduce

https://stackblitz.com/edit/vitejs-vite-pkdvs2ub?file=src%2FApp.vue

run vue-tsc

See that trying to reference the globally augmented types declared in src/global.d.ts (in this case from tiptap) errors in the vue file but NOT global-test.ts. In my ide (neovim) it's even weirder, when I go to references (in vue files) it only finds vue references, but because the augmentations are in typescript files, it doesn't see them. Similarly go to reference in typescript files does not see the vue references.

If you do pnpm add vue-tsc@2 -D and run vue-tsc error goes away so something between version 2 and 3 changed.

What is expected?

Does not give a type error on the augmented property access in App.vue

What is actually happening?

❯ vue-tsc --noEmit
src/App.vue:4:28 - error TS2339: Property 'yourCommand' does not exist on type 'SingleCommands'.

4 type Test = SingleCommands['yourCommand'];

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-pkdvs2ub?file=src%2FApp.vue

Any additional comments?

I was trying to figure out if this was a vue-tsc issue or something wrong with tiptap's types hence why that package. Declaring properties on, for example, Window, seem unaffected (also tested in repro).

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions