Subscribe on changes!

`withDefaults` in dev mode, appears props warn

avatar
Sep 8th 2023
- age: number
+ age?: number
avatar
Sep 8th 2023

This is as expected

withDefaults(defineProps<{
    age: number
}>(), {
    age: 1
})

Equivalent to

export default {
  props: {
    age: {
      type: Number,
      required: true,
      default: 1
    }
  }
}

When a props is required to be passed in, it means that it needs to be passed to the component anyway, whether it has a default value or not