WebStorm:参数类型,不能分配给参数类型ObjectConstructor

时间:2019-01-15 16:37:18

标签: typescript webstorm

当我在TypeScript中使用以下构造函数时,出现错误Argument type,它不能分配给参数类型ObjectConstructor。但是CLI不会显示该错误。该代码对我来说看起来不错(syntax)。这是错误的错误吗?

export class Store{
  oid: string;
  storeNumber: string;
  address: string;

  public constructor(init?: Partial<Store>) {
    Object.assign(this, init);
  }
}

1 个答案:

答案 0 :(得分:1)

This has been logged as a WebStorm bug. (Thank you, @lena).

Until a fix is issued, one could supress the inspection by placing the following comment above the line containing the false positive:

// noinspection TypeScriptValidateTypes