[Vuejs]-Why is TS complaining of type usage when a type entry is expected?

3👍

Try this:

import { PropType } from "vue";
...
corvees: {
  type: Array as PropType<CorveesI[]>
}

Reference: https://v3.vuejs.org/guide/typescript-support.html#annotating-props

3👍

The type expected in prop definitions are not TypeScript types (as all TS types are compiled away when TS compiler transforms your code to plain JS) but JS runtime types. So only types mention in the above linked docs are valid.

To properly type the prop in TS, you must use PropType<>Annotating props

import { PropType } from "vue";
...
corvees: {
  type: Array as PropType<CorveesI[]>
}

Leave a comment