TS2694: Namespace ‘‘ has no exported member
问题描述
当前我在src/types/route
文件下定义了一个namespace
——AuthRoute
,内部定义了接口Route
import { RouteComponent } from "vue-router";/** 权限路由类型 */
declare namespace AuthRoute {/** 路由描述 */type RouteMeta = {/** 路由标题——可作为document.title 或 菜单名称 */title: string,/** 对应图标 */icon?: string,/** 路由顺序 */order?: number,}/** 单个路由的类型结构* ——后端返回该类型结构的路由*/interface Route {/** 路由名称(路由的唯一标识) */name: RouteKey,/** 路由路径 */path: string,/** 路由重定向 */redirect: string,/** 路由描述 */meta: RouteMeta,/** 子路由 */children?: Route[],/** 路由组件 */component?: RouteComponent}
}
在其他目录文件下使用AuthRoute.Route
,报错
命名空间内没有导出的成员
Route
报错代码
/* eslint-disable */
import AuthRoute from "@/types/route";const teacherRoute: Array<AuthRoute.Route> = [
……
];export default teacherRoute;
解决方法
方法一:加上大括号
/* eslint-disable */
import { AuthRoute } from "@/types/route";const teacherRoute: Array<AuthRoute.Route> = [
……
];export default teacherRoute;
方法二:加上同名
再加上同名的AuthRoute
即可
即
/* eslint-disable */
import AuthRoute from "@/types/route";const teacherRoute:
Array<AuthRoute.AuthRoute.Route> = [
……
];export default teacherRoute;
TS2694: Namespace ‘‘ has no exported member相关推荐
- angular: 代码正确的情况下npm不断提示 TS2307: Cannot find module XXX , TS2305: Module XXX has no exported member
探索angular. 照搬示例模块,添加了自定义的模块,名称为device,代码全部正确,VSCode没有报错,但是npm启动时各种报错: 主要是TS2307: Cannot find module. ...
- has no exported member
/node_modules/vue/dist/vue"' has no exported member has no exported member 'reactive'. Did you ...
- VUE3 has no exported member ‘toRefs‘
升级typescript版本到 "typescript": "^4.3.5" vue.js - Vue / Typescript, got Module '&q ...
- Module ‘“../node_modules/@types/react-router“‘ has no exported member ‘withRouter‘.
造成原因 项目typescript 是 3.9的版本,@types/react-router 依赖也没有固定版本,导致@types/react-router升级以后,采用了3.9不支持的语法,导致报错 ...
- E0135 namespace “std“ has no member “back_inserter“
增加 #include <iostream> 问题解决
- node_modules/rxjs/Rxamp;amp;quot;' has no exported member 'of'
按照官方文档写代码 import { Injectable } from '@angular/core'; import { Observable, of } from 'rxjs'; //impor ...
- ASP.NET MVC5 网站开发实践(二) Member区域 - 用户部分(2)用户登录、注销
上次实现了用户注册,这次来实现用户登录,用到IAuthenticationManager的SignOut.SignIn方法和基于声明的标识.最后修改用户注册代码实现注册成功后直接登录. 目录: ASP ...
- sequelize V5 升级记录
最近把项目中的 sequelize 由 4.38.0 升级到了 5.8.7,以下是升级记录 本文地址: shanyue.tech/post/sequel- 01 删包 从 package.json 中 ...
- typescript ts 错误列表
code 类型 英文描述 中文描述 1002 错误 Unterminated string literal. 未终止的字符串文本. 1003 错误 Identifier expected. 应为标识符 ...
最新文章
- 云炬Android开发笔记 7登陆注册功能开发
- ASP.NET MVC3 + Ninject.Mvc3 依赖注入原来可以这么简单
- CodeSmith和PowerDesigner的使用安装和数据库创建(原创系列教程)
- 校园宿舍管理系统课程设计报告
- The World is a Theatre(组合数学)
- Spring-Quartz (一)
- python middleware_Django 中间件
- 【Day03】使用原型最大的好处及原型链的理解
- C++ ------------------- string类介绍
- IDEA合并SVN分支代码到主干
- 安卓彩虹DS网网站源码去授权版 附详细视频教程
- 软件测试学习之悟空CRM项目测试用例编写
- 关于深度学习的网络流量分类论文整理(一)
- 什么是程序?什么是程序设计?
- ffmpeg里转场transition
- 数学建模常用模型05 :多元回归模型
- ajax提交多个form表单
- 学习Oracle Applications 相关文档
- DISABLE BUTTON
- 这款引文数量全球的SOD检测试剂盒,你可能想不到