Error due to type signature mismatch of defineModel() / useModel() #10689
Unanswered
pixelistik
asked this question in
Help/Questions
Replies: 1 comment 3 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.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I use
defineModel()
in a component.But during webpack bundling, I get the TypeScript error
TS2558: Expected 3 type arguments, but got 1.
What seems to be happening is this:
defineModel()
is a Vue SFC compiler macro, which generates a call to theuseModel()
function, as we can see in the test cases for the compiler.So
defineModel<T>
becomesuseModel<T>
after the macro is expanded.But the
useModel()
function actually has 3 type parameters, not only<T>
, as we can see in the code (distributed as@vue/runtime-core/dist/runtime-core.d.ts
):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.
All reactions