Reputation: 1272
edit: similar to vitejs bug but different because I don't reimport.
edit2: i just created a new clean project vue build tools and just selected the typescript features and it still doesn't work.
edit3: demo
I can't import the following interface
:
export interface Topic {
title: string;
description: string;
}
in App.vue
:
import { Topic } from "@/models/topic";
The requested module '/src/models/topic.ts' does not provide an export named 'Topic'
What is happening here? I followed this guide vue build tools
Upvotes: 2
Views: 4241
Reputation: 63
You have two problems here:
1 - In the script tag you forgot to tell vue that you want to use TS:
<script setup lang="ts">
2 - The way to import a type or interfaces should be as follow:
import type { Topic } from './models/topic'
Upvotes: 5