问题描述
大张旗鼓地打字到一个大json文件的打字稿代码源后,我需要清理具有相同内容的打字稿类型,并清理所有将新类型放入另一个类型的生成的类型声明。 示例:
export type V2AuthenticationResource = {
grantType?: string;
password?: string;
refreshToken?: string;
token?: string;
username?: string;
};
export type PostRestapiV20AuthBodyParameters = V2AuthenticationResource;
export type DeleteRestapiV20AuthBodyParameters = V2AuthenticationResource;
PostRestapiV20Auth(
body: PostRestapiV20AuthBodyParameters //here i can use V2AuthenticationResource instead
): ApiResponse<V2AuthenticationResponse> {
const path = "/restapi/v2.0/auth";
return this.requestFactory(
path,undefined,body,"POST"
);
}
DeleteRestapiV20Auth(
body: DeleteRestapiV20AuthBodyParameters //here i can use V2AuthenticationResource instead
): ApiResponse<V2AuthenticationResponse> {
const path = "/restapi/v2.0/auth";
return this.requestFactory(
path,"DELETE"
);
}
或
export type V2DeviceData = {
deviceid: string;
deviceName: string;
}
export type V2DeviceInfo = {
deviceid: string;
deviceName: string;
}
代码工作正常,我只想减小文件大小,因为我已经进行了数百次重复。 我使用的是Visual Studio Code,我尝试搜索扩展名,但找不到任何内容。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)