Closed TheDutchCoder closed 2 months ago
Here's a reproduction on the Playground.
Comp2 has the squiggly lines and shows the missing required prop error (as well as the browser warning). If you comment out Comp2, you'll see that Comp1 does not have the squiggly lines but the browser still shows the warning.
I wonder if this is a Vue compiler problem instead?
Using vue@3.5
locally should show error.
And you might need to update Vue - Official to the latest version (2.0.28).
Using
vue@3.5
locally should show error.
It doesn't (see Playground)
Debugging on the playground is difficult, please try it locally and ensure that tsconfig.json
contains the following options:
"vueCompilerOptions": {
"target": 3.5
}
Even with 3.5 (which is in beta btw, not something Nuxt supports) it still doesn't properly show errors. Here are screenshots for the different situations:
Required prop - without default (correct: error)
Required prop - with default (incorrect: no error)
Weird, it works on my machine.
Check if the declaration file points to the correct version? It should include MakeDefaultsOptional
that controls this behavior.
I'm not sure what I'm supposed to check (and where).
Side note: the VSCode extension only has version 2.0.10 available, no other versions are released as far as VSCode can tell, maybe that's the issue? (An older version of the tools?)
Yup that's the issue! It was stuck on that version and never updated it. I just uninstalled and did a clean re-install and now it works. Looks like something went awry with publishing versions at some point? 🤔
I'll update all my workspaces, and close the issue, thanks!
Vue - Official extension or vue-tsc version
2.0.10
VSCode version
1.92.2
Vue version
3.4.31
TypeScript version
5.5.4
System Info
Steps to reproduce
Just declare props in a TS-based component, but make a prop required and have a default. There's a few issues with this:
The bottom line is that the user isn't aware of the problem anywhere during development until the open the browser console (and even then it's not clear what the issue is: a default value on a required prop)
What is expected?
content: string
line or on thecontent: 'test'
lineWhat is actually happening?
Nothing, which doesn't make the user aware that a required prop is missing during implementation.
Link to minimal reproduction
No response
Any additional comments?
No response