Vetur cannot find the type when using PropType<User> in the referenced component. TemplateInterpolationService is set to true as well as validate templateProps.

"vetur.experimental.templateInterpolationService": true,"vetur.validation.templateProps": true,Hello.vue<template>
<div>
Hello, {{ user.name }}
</div>
</template>
<script lang="ts">
import { defineComponent } from '@nuxtjs/composition-api'
import type { PropType } from '@nuxtjs/composition-api'
type User = {
name: string;
}
export default defineComponent({
props: {
user: {
type: Object as PropType<User>,
required: true
}
},
setup () {
return {}
}
})
</script>
Greeting.vue<template>
<hello :user="{name: 'hello'}" />
</template>
<script lang="ts">
import { defineComponent } from '@nuxtjs/composition-api'
import Hello from './Hello.vue'
export default defineComponent({
components: {
Hello
}
})
</script>
This works fine if I use an anonymous type. Tried to trick the compiler to omit the actual type without any success.
type User = {name: string}
const trick = <T extends unknown>() => () => undefined as unknown as {
[K in keyof T]: T[K]
}
const TrickedUser = trick<User>()
export default defineComponent({
props: {
user: {
type: Object as PropType<ReturnType<typeof TrickedUser>>,
required: true
}
},
setup () {
return {}
}
})
This gives the following component type props:

But vetur is still complaining, in this case it cannot find TrickedUser
I ran into something very similar using [email protected]
Repro: https://github.com/cexbrayat/vti-async
npx [email protected] diagnostics
Results in:
====================================
Getting Vetur diagnostics
Loading Vetur in current directory: /Users/ced-pro/Code/vue/vti-async
Loaded bundled [email protected].
Vetur initialized
====================================
Getting diagnostics from: [ 'src/App.vue', 'src/components/HelloWorld.vue' ]
File : /Users/ced-pro/Code/vue/vti-async/src/App.vue
Error: Cannot find name 'UserModel'.
====================================
Because the component HelloWorld has a prop defined as:
export default defineComponent({
name: 'HelloWorld',
props: {
user: {
type: Object as PropType<UserModel>
}
}
});
Most helpful comment
I ran into something very similar using [email protected]
Repro: https://github.com/cexbrayat/vti-async
Results in:
Because the component HelloWorld has a prop defined as: