I wrote an interface that I want to use in my component. However, it seems like I can't really import the interface and I can't see the reason why.
Here's the important code:
My interface in src/types/Job.ts
interface Job {
name: string,
salary: string,
isPopular: boolean
}
export default Job
And my App.vue setup function & import:
<script lang="ts">
import { defineComponent, ref } from 'vue'
import Job from './types/Job'
export default defineComponent({
setup() {
const jobs = ref<Job[]>([
{
...
},
{
...
}
])
return { jobs }
}
})
As an error I am getting the following:
Uncaught SyntaxError: The requested module '/src/types/Job.ts' does not provide an export named 'default' (at App.vue:55:8)
And I really wonder why or what is missing. Anyone an idea?
CodePudding user response:
Try out to add type
after the import keyword :
import type Job from './types/Job'