Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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>;
}>();
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading