-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
fix(runtime-core): withDefaults & union types #11949
Conversation
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
@edison1105 what's the runtime issue of #11758 and #8952? The way I see it: There are runtime issues in regards to default props as well as type issues with certain typescript constructs (union types) when using the |
color:{
type:String,
validator:(value, props)=>{
if(value==='white'){
return props.appearance === 'outline'
}else{
//...
}
}
}, |
Ah, yes. Thanks for the clarification. I think I will use this PR to add the needed runtime changes. Btw: My assumption is that changing the props options interface to allow computed
The following behavior in the compiler will need to be changed as well.
|
Improves typing of props when using union types in combination with
withDefaults
.Fixes
Affects
#9125
Explanation
We can skip the Omit<T, Defaults> in
because we're overloading the omitted keys with key/value of Defaults and the mapped type modifier anyways: