Types and interfaces declared in included `*.d.ts` files aren't resolved by Vue
Vue version
Link to minimal reproduction
Steps to reproduce
- Open reproduction link
- See the interface declared in
src/types.d.ts
src/components/HelloWorld.vue
does not show any errors in the IDE- See the error in the terminal and preview.
What is expected?
Declared types should be resolved by Vue
What is actually happening?
The TestProps
interface is not resolved resulting in error:
10:18:57 AM [vite] Internal server error: [@vue/compiler-sfc] Unresolvable type reference or unsupported built-in utility type
/home/projects/vitejs-vite-aextkq/src/components/HelloWorld.vue
1 | <script setup lang="ts">
2 | defineProps<TestProps>();
| ^^^^^^^^^
3 | </script>
4 |
Plugin: vite:vue
File: /home/projects/vitejs-vite-aextkq/src/components/HelloWorld.vue
at error (/home/projects/vitejs-vite-aextkq/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:15841:11)
at innerResolveTypeElements (/home/projects/vitejs-vite-aextkq/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17966:20)
at resolveTypeElements (/home/projects/vitejs-vite-aextkq/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17902:35)
at resolveRuntimePropsFromType (/home/projects/vitejs-vite-aextkq/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:19312:39)
at genRuntimePropsFromTypes (/home/projects/vitejs-vite-aextkq/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:19288:44)
at genRuntimeProps (/home/projects/vitejs-vite-aextkq/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:19278:18)
at compileScript (/home/projects/vitejs-vite-aextkq/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:20383:36)
at resolveScript (/home/projects/vitejs-vite-aextkq/node_modules/@vitejs/plugin-vue/dist/index.mjs:299:31)
at genScriptCode (/home/projects/vitejs-vite-aextkq/node_modules/@vitejs/plugin-vue/dist/index.mjs:2485:31)
at transformMain (/home/projects/vitejs-vite-aextkq/node_modules/@vitejs/plugin-vue/dist/index.mjs:2298:54)
at transform (/home/projects/vitejs-vite-aextkq/node_modules/@vitejs/plugin-vue/dist/index.mjs:2810:16)
at transform (/home/projects/vitejs-vite-aextkq/node_modules/vite/dist/node/chunks/dep-abb4f102.js:44258:62)
System Info
System:
OS: Linux 5.0 undefined
CPU: (2) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 16.20.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.4.2 - /usr/local/bin/npm
pnpm: 8.6.3 - /usr/local/bin/pnpm
npmPackages:
vue: ^3.3.4 => 3.3.4
Any additional comments?
I wanted to add some globally available props that would be a common ground for my input components but Vue crashes despite of Volar not showing the errors.
Original Nuxt issue: https://github.com/nuxt/nuxt/issues/22209#issuecomment-1641767854