defineProps Parsing error regarding prop type: Unexpected token. Did you mean `{'}'}` or `}`?

const props = defineProps({
  selectedData: <Record<string, string>>
});

there is a red line under the closing bracket, saying

Parsing error: Unexpected token. Did you mean {'}'} or
&rbrace;?eslint Expression expected.ts(1109)

Am I defining the type incorrectly? I am not sure how else to do to it.
I was tying to follow this example given by vue.js: https://vuejs.org/guide/typescript/composition-api.html#typing-component-props

>Solution :

In the documentation for Vue:

If you are using TypeScript, it is also possible to declare props and emits using pure type annotations.

That means you could just use:

const props = defineProps<{
  selectedData: Record<string, string>;
}>();

Leave a Reply