Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types and interfaces declared in included *.d.ts files aren't resolved by Vue #8812

Closed
wvffle opened this issue Jul 19, 2023 · 1 comment
Closed

Comments

@wvffle
Copy link

wvffle commented Jul 19, 2023

Vue version

vue@3.3.4

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-aextkq?file=src%2FApp.vue,src%2Fcomponents%2FHelloWorld.vue,src%2Ftypes.d.ts&terminal=dev

Steps to reproduce

  1. Open reproduction link
  2. See the interface declared in src/types.d.ts
  3. src/components/HelloWorld.vue does not show any errors in the IDE
  4. 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: nuxt/nuxt#22209 (comment)

@edison1105
Copy link
Member

duplicate of #8612
see #8612 (comment)

@github-actions github-actions bot locked and limited conversation to collaborators Sep 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants