[Vuejs]-Vue Typescript Define props with default values for complex objects

1👍

The mistake was not adding a return for entry. The correct code looks like this:

const props = withDefaults(defineProps<Props>(), {
  entry: () => {
    return {
      id: 1,
      body: "",
      emoji: null,
      createdAt: new Date(),
      userId: 1,
    };
  },
  userName: "Unknown",
});

Thank you
Moritz Ringler
for the help

Leave a comment