0👍
✅
Vue does not support generic types at the moment (vue@3.3.4)
(there is issue https://github.com/vuejs/core/issues/8482 )
(there is PR https://github.com/vuejs/core/pull/8511 )
The only ones are supported are hacked in via TS
const SupportedBuiltinsSet = new Set([
'Partial',
'Required',
'Readonly',
'Pick',
'Omit'
] as const)
// [@vue/compiler-sfc] Unresolvable type reference or unsupported built-in utility type
// /home/projects/vitejs-vite-1sv1xj/src/components/HelloWorld.vue
// 2 | import { ref } from 'vue'
// 3 |
// 4 | type Exactly<T> = T;
// | ^
type Exactly<T> = T;
defineProps<Exactly<{ msg: string }>>()
See https://github.com/vuejs/core/blob/main/packages/compiler-sfc/src/script/resolveType.ts#L528
Source:stackexchange.com