【发布时间】:2019-12-02 01:35:58
【问题描述】:
我们正在使用提供的 Typescript ServicStack 参考工具生成 DTO,但它会导致 eslint 警告。
失败的 lint 规则是 no-angle-bracket-type-assertion,有关详细信息,请参阅此:https://palantir.github.io/tslint/rules/no-angle-bracket-type-assertion/
我可以禁用该规则并禁止它,但这会引入歧义,如https://basarat.gitbooks.io/typescript/docs/types/type-assertion.html 所述,因此建议使用新语法。
目前它们使用尖括号语法(the )生成:
public constructor(init?:Partial<ResponseError>) { (<any>Object).assign(this, init); }
但他们应该使用“as any”语法:
public constructor(init?:Partial<ResponseError>) { (Object as any).assign(this, init); }
有谁知道如何更改生成的 DTO 或只忽略这一个文件?
【问题讨论】: