首页 前端知识 Vue3 Vite TypeScript中声明ts文件导出接口报错

Vue3 Vite TypeScript中声明ts文件导出接口报错

2024-09-14 23:09:33 前端知识 前端哥 399 848 我要收藏

一、报错信息

SyntaxError: The requested module '/src/apis/blackAccount/types.ts' does not provide an export named 'BlackAccountForm'

二、解决办法

尝试在import的时候将import {xxx} from 'xxx'改成import type {xxx} from 'xxx'

import type { BlackAccountForm, BlackAccountQuery } from "@/apis/blackAccount/types";

三、原因

 Vite 中类型需要使用这个特殊的语法导入,主要用来导入和导出类型

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html

 

转载请注明出处或者链接地址:https://www.qianduange.cn//article/18267.html
标签
评论
发布的文章

关于HTML的知识

2024-09-18 23:09:36

js简单实现轮播图效果

2024-09-18 23:09:36

CSS3美化网页元素

2024-09-18 23:09:27

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!