-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Missing required prop" warning after mounting component with union as props #9125
Comments
Both cross type and union type compiled props are required.
But you can make them optional
|
if it's categorically illegal then it should be a proper error which refuses to type-check |
putting a union in |
cc/ @sxzz |
similar to #8952 |
Would love it if I could at least suppress the runtime type check warning because other than that it works fine. |
@edison1105 Should vue core handle this? vue-macros is suitable for this work IMO. |
This can be listed as an improvement of |
Hey, I think this would make the template attributes behave as expected. Can someone confirm this? File: vuejs/core/packages/runtime-core/src/componentPublicInstance.ts type UnionOmit<T, K extends keyof any> = T extends T ? Omit<T, K> : never
...
/* line 211 */ ? Partial<Defaults> & UnionOmit<P & PublicProps, keyof Defaults>
... I took the idea for |
Vue version
3.3
Link to minimal reproduction
https://play.vuejs.org/#__DEV__eNqFUs1O9DAMfBV/uSxIfFvB3kpZCRAScAAESFxyKa1bAmkSJemyUsi746TaZQ/8nFrP2PHY48BOjZmvRmQlq1xjhfHg0I8GZK36E86842zJlRiMth4CWOwgQmf1ADMqm22pcz2YCedsXqQoPcvZMVdcNVo5D4Pr4SS9sDe7RCk1PGkr23+zfa6qYmpOrSjwOBhZe6QIoHo5XIaQi2OsCooyKpQZPaz+D7pFSUKJz0qJmqRoTWjt2o6zYgcvn2tLxOHRYsKrYtuNHdC4JLUT/fzVaUU7CamQs4YqhUR7a7ygUTgrITOJq2mS9+uMeTviwQZvXrB5+wZ/deuEcXZn0aFd0Y62nK9tj36iLx5ucE3/W5ImHSVl/0Leo9NyTBqntLNRtSR7Jy+rvcqWCdU/uou1R+U2QyWhKTPmfM7IwbS0n0b/kruYL3IdV5G2uHH/j6OarsJYbRzdRYudUHiXoiqQeyU4b0ljhA8IZFoJahye0cbl3j4d1Y8XU7ViRZ+NBgghd4ikrSombtfz+Amh+wLo
Steps to reproduce
Open console; observe warning.
What is expected?
No warning.
alternatively, one of:
<script>
)What is actually happening?
System Info
System: OS: Linux 6.5 Manjaro Linux CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor Memory: 19.29 GB / 31.23 GB Container: Yes Shell: 3.6.1 - /usr/bin/fish Binaries: Node: 20.5.1 - /usr/bin/node Yarn: 1.22.19 - /usr/bin/yarn npm: 9.8.1 - /usr/bin/npm npmPackages: vue: ^3.3.4 => 3.3.4
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: