typescript - vue-router.d.ts(734, 5):预期的类型来自属性 'children',它在类型 'MyType' 上声明
问题描述
可以m
在一级和二级使用,但是三级后提示错误
这个错误是关于的RouteRecordRaw
,因为用自定义类型替换不会出现
代码:
包.json
{
"name": "bug-demo-type",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"vue-router": "^4.0.3"
}
}
索引.ts
import { RouteRecordRaw } from 'vue-router';
type MyType = RouteRecordRaw & {
m?: string;
children?: Array<MyType>;
};
const ddd: Array<MyType> = [
{
path: '',
redirect: '',
children: [
{
m: '',
path: '',
redirect: '',
children: [
{
m: '',
path: '',
redirect: '',
children: [
{
path: '',
redirect: '',
},
],
},
],
},
],
},
];
解决方案
推荐阅读
- java - 我使用 mediacord 的应用程序被破坏了
- ssis - 通过 SSIS 处理 Azure 分析服务。错误:无法连接到远程服务器
- javascript - Javascript Timer 项目:为什么 clearInterval 不起作用?
- windows - 当我尝试复制和重命名 80K 文件时,XCOPY 崩溃。有没有更好的办法?
- javascript - 为什么我不能使用 nodemailer 和 nodejs 发送电子邮件?
- javascript - 你如何在每个堆积柱形图(谷歌图表)上编码一个总计?
- python - 如何使用 matplotlib 在 pytorch 上显示损失和准确度图
- sql - 如何访问 sqlite 模型中的外键字段?
- php - 将所有列加起来
- java - 如何在 Intellij Idea 的代码块中关闭参数名称提示?