Subscribe on changes!

Vue 3.3.0-beta definesProps with import seem cache (order ?) dependent ?

avatar
May 6th 2023

Vue version

3.3.0-beta

Link to minimal reproduction

https://github.com/ppierre/test-bug-vue-3.3-defineprops-with-import

Steps to reproduce

npm i -f && npm run dev

What is expected?

Should work fine. Sadly it is a assignment support it worker for me and for some student. But not for every body, I have version of the same code who work without any meaning-full difference !

What is actually happening?

[plugin:vite:vue] [@vue/compiler-sfc] Unresolvable type reference or unsupported built-in utility type

Bug with defineProps and TypeScript import :
MaisonCard.vue

// Bug
import type { MaisonResponse } from '@/pocketbase-types'
// Work with extra import `MaisonRecord`
import type { MaisonResponse, MaisonRecord } from '@/pocketbase-types'
defineProps<MaisonResponse>()

pocketbase-types.ts

export type MaisonResponse = Required<MaisonRecord> & BaseSystemFields

Error message :

[plugin:vite:vue] [@vue/compiler-sfc] Unresolvable type reference or unsupported built-in utility type

<snip>.../src/components/MaisonCard.vue
<snip>.../src/components/MaisonCard.vue
    at ScriptCompileContext.error (<snip>.../node_modules/vue/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:15839:11)
    at innerResolveTypeElements (<snip>.../node_modules/vue/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17964:20)
    at resolveTypeElements (<snip>.../node_modules/vue/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17900:35)
    at resolveBuiltin (<snip>.../node_modules/vue/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18222:13)
    at innerResolveTypeElements (<snip>.../node_modules/vue/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17952:20)
    at resolveTypeElements (<snip>.../node_modules/vue/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17900:35)
    at <snip>.../node_modules/vue/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17922:31
    at Array.map (<anonymous>)
    at innerResolveTypeElements (<snip>.../node_modules/vue/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17922:20)
    at resolveTypeElements (<snip>.../node_modules/vue/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17900:35

System Info

System:
    OS: macOS 13.3.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 4.31 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.1.0 - /opt/homebrew/bin/node
    npm: 9.6.4 - /opt/homebrew/bin/npm
  Browsers:
    Brave Browser: 105.1.43.89
    Chrome: 113.0.5672.63
    Firefox: 112.0.2
    Safari: 16.4
  npmPackages:
    vue: ^3.3.0-beta.2 => 3.3.0-beta.2

Any additional comments?

No response