You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello dear community 👋
I am struggling with TS props definition and
withDefaults
to have 'undefined' props. Here is a simple demo below.child
<separator />
componentIt receives a
height
prop. A default value of let's day '1rem' is set if void.<title-bar />
componentseparatorHeight
is an optional prop, its value should remainundefined
so separator can apply a default value.title-bar.vue
I get this error:
If I omit
separatorHeight
inwithDefaults
I get this warning :Is the only way out :
const { color = 'darkblue' } = defineProps<Props>()
? because I'd like to not mix props and component variables.What is the proper way of doing it ?
Beta Was this translation helpful? Give feedback.
All reactions