react-navigation - 如何在 react-navigation v6 中覆盖全局 RootParamList
问题描述
在 react-navigation v6 的升级指南中:
它声明您可以使用
declare global {
namespace ReactNavigation {
interface RootParamList extends RootStackParamList {}
}
}
在代码中的某处为所有钩子等全局设置 RootParamList。
但是,当我尝试包含该片段并设置我的参数列表时,我得到的只是
Duplicate identifier 'RootParamList'.ts(2300)
types.d.ts(5, 19): 'RootParamList' was also declared here
显然,该类型已经声明,我正在尝试覆盖它,但这似乎是不可能的。
任何想法如何覆盖而不导致类型错误?
解决方案
推荐阅读
- c# - c#中浮点数数组的定义
- c++ - 从仅 1 个子项目的 cmake 文件中获取“//usr/lib/x86_64-linux-gnu/libcrypto.so.1.1:添加符号时出错:命令行中缺少 DSO”
- c# - Nexmo C# whatsapp 集成
- php - For [PHP] 中的数组合并
- php - SQLSTATE 错误 23000 完整性和数据库冲突,更新或添加外键时出错
- matlab - Matlab角度函数来计算相位
- spring - 为什么 Spring Boot 失去了它的 Handler Mapping?
- javascript - 如何断言传递给类构造函数的函数是通过引用传递的,并且在使用组合时不重复?
- java - CDI 事件 fire() 创建新的观察者实例
- html - 将此渐变图像转换为 CSS 渐变