javascript - 如何更改接口结构并重命名 VS Code 中的所有引用
问题描述
我有一个界面
interface IApplicationState {
config: IConfig;
lang: ILang;
//many others
}
目前在许多地方使用,例如在带有connect
from的类中react-redux
,或在 reducers 方法中,例如:
const setLangReducer = (state: IApplicationState , { lang }: { lang: LangType }): IApplicationState => ({
...state,
lang: {
currentLang: lang
}
});
我想在根级别添加一些文件,并且所有现有的作为新属性的子级向下移动,例如:
interface IApplicationState {
generalConfigs: {
config: IConfig;
lang: ILang;
};
externalConfig: {
domain: string;
}
}
如果我手动进行更改,我将必须修复从根到config
和的所有引用lang
generalConfigs.config
generalConfigs.lang
也许有一些自动选项可以通过更改接口结构来更改所有引用?
解决方案
如果您想更改所有需要按 ctrl 的名称,然后按 3 次 R
推荐阅读
- jquery - jquery滑块在左侧不能很好地滑动
- microsoft-translator - 自定义翻译器 - 模型训练失败并且“用过的句子”比预期小
- kubernetes - 如何从死掉的 kubernetes 集群中提取配置和其他信息?
- stack - ECMA CLI 规范:CIL 指令的堆栈转换图符号
- asp.net - Implementing Blazor Server-Side to existing Asp.NET 4.6.1 project?
- access-violation - Exception thrown at 0x7A12FF80 (ucrtbased.dll) in Project 3.exe: 0xC0000005: Access violation reading location 0x00000000
- arrays - 如何在bash中从数组中创建if条件
- c++ - 使用 .inl 内联文件的不完整前向声明
- c++ - 为矩阵创建模板时出错
- javascript - Is it safe to access public keys (in front-end modules) using the dotenv library, if server-side (private keys) are also stored in the same .env file?