Skip to content

Named export inside script setup not recognized #3316

@frankykubo

Description

@frankykubo

I am using Vue 3.3.4 with latest typescript building with vite.

In File 1, I have `<script setup lang="ts"> and inside defined interface:

export interface Prefix {
    country_iso_code: string;
    country_name: string;
    dial_code: string;
    id:number;
}

In File 2, I have same script tag and inside importing:

import type { Prefix } from '@/components/parts/Register/Steps/RegisterPhoneNumber.vue';

The code works well and IDE (WebStorm) does not report any issue.

But when I run vue-tsc --noEmit , it gives me an error saying:

src/components/form/File2.vue:4:15 - error TS2614: Module '"@/components/parts/.../File1.vue"' has no exported member 'Prefix'. Did you mean to use 'import Prefix from "@/components/parts/.../File1.vue"' instead?

import type { Prefix } from '@/components/parts/.../File1.vue';
~~~~~~

src/components/.../File1.vue:21:1 - error TS1184: Modifiers cannot appear here.
export interface Prefix {
~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions