Below is a snippet of code for a Vue3 component that takes in an Array of Objects as a prop:
<script lang="ts">
interface CorveesI {
What: string,
Who: string,
Debit: number
}
export default {
name: 'Corvees',
props: {
corvees: {
type: CorveesI[]
}
},
(...)
During compilation, there is a warning specifically on the line type: CorveesI[]
:
TS2693: 'CorveesI' only refers to a type, but is being used as a value here.
Uncertain about how to address this issue, as I am specifying the type of corvees
, providing a type but then told it's expected as a value.
I consulted the documentation on Type Checks but couldn't connect the dots between my interface
and the constructor.
Fearing my understanding of interface
may be flawed, I delved into the TS doc for Object Types but found it more like a type description (similar to type
in Golang, for example). Consequently, confusion heightened.