当我在TypeScript中使用以下构造函数时,我得到的错误参数类型是不能分配给参数类型ObjectConstructor的。但CLI没有显示错误。代码在我看来没问题( syntax ).这是一个错误吗?
export class Store{ oid: string; storeNumber: string; address: string; public constructor(init?: Partial<Store>) { Object.assign(this, init); } }
这已被记录为 WebStorm bug (谢谢, @lena ).
在发布修复程序之前,可以通过在包含假阳性的行上方放置以下注释来禁止检查:
// noinspection TypeScriptValidateTypes