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
Uh oh!
There was an error while loading. Please reload this page.
-
Hello dear community 👋
I am struggling with TS props definition and
withDefaultsto have 'undefined' props. Here is a simple demo below.child
<separator />componentIt receives a
heightprop. A default value of let's day '1rem' is set if void.<title-bar />componentseparatorHeightis an optional prop, its value should remainundefinedso separator can apply a default value.title-bar.vue
I get this error:
If I omit
separatorHeightinwithDefaultsI 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