JS defineProps() does not mark props as required #4876
Labels
bug
Something isn't working
good reproduction ✨
This issue provides a good reproduction, we will be able to investigate it first
Vue - Official extension or vue-tsc version
2.1.6
VSCode version
1.93.1
Vue version
3.5.8
TypeScript version
5.5.4
System Info
package.json dependencies
Steps to reproduce
JS (not TS)
defineProps
with a required prop:In another component, import this component and use it in the template.
What is expected?
The prop cannot be omitted.
What is actually happening?
The prop is falsely marked as optional.
This image is from the repro repo:
When you define the component globally via
components.d.ts
, the typing becomes more obvious:There's no error for the missing
required_prop
on the left. When I addlang="ts"
to the script tag on the right, the error appears.Link to minimal reproduction
https://github.com/phil294/vue-bug-repo
Any additional comments?
When you define props as
nothing works at all. This was already reported in #4074 and is allegedly because of #3690 (which to me it doesn't seem like it but idk) which is labelled as a "minor" bug. In my opinion this isn't minor as arguably the main point of Volar, IntelliSense in Vue templates, is pretty much unusable if you're not using TS :-S
The text was updated successfully, but these errors were encountered: