Error due to type signature mismatch of defineModel() / useModel() #10689
-
I use <script setup lang="ts">
type Option = {
key: string;
value: any;
};
const selectedValue = defineModel<Option>("selectedValue"); But during webpack bundling, I get the TypeScript error What seems to be happening is this:
So But the
So the error message seems to make sense. But the problem is not reproducable in the Vue Playground. How do I fix this? Is webpack somehow looking at the wrong type definitions? Is this a bug in Vue? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Your build setup is type checking the generated render function code, which it should not do. Templates are converted to Javascript, not Typescript. What's your setup? I |
Beta Was this translation helpful? Give feedback.
set ts-loader to
transpileOnly: true
and use the official Vue language Tools (vue-tsc
) to typecheck.https://vuejs.org/guide/typescript/overview.html#note-on-vue-cli-and-ts-loader