Open dietergoetelen opened 4 years ago
I ran into something very similar using VTI@0.0.13
Repro: https://github.com/cexbrayat/vti-async
yarn
npx vti@0.0.13 diagnostics
Results in:
====================================
Getting Vetur diagnostics
Loading Vetur in current directory: /Users/ced-pro/Code/vue/vti-async
Loaded bundled typescript@4.0.3.
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>
}
}
});
Info
Problem
Vetur cannot find the type when using
PropType<User>
in the referenced component. TemplateInterpolationService is set to true as well as validate templateProps.Reproducible Case
"vetur.experimental.templateInterpolationService": true,
"vetur.validation.templateProps": true,
Hello.vue
type User = {name: string}
const trick =() => () => undefined as unknown as {
}
const TrickedUser = trick()
export default defineComponent({ props: { user: { type: Object as PropType<ReturnType>,
required: true
}
},
setup () {
return {}
}
})