jprism
jprism

Reputation: 3474

WebStorm: Argument type this is not assignable to parameter type ObjectConstructor

When I use the following constructor in TypeScript, I get the error Argument type this is not assignable to parameter type ObjectConstructor. But CLI is not showing the error. The code looks OK to me (syntax). Is this a false error?

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

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

Upvotes: 6

Views: 4127

Answers (1)

tao
tao

Reputation: 90068

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

Upvotes: 6

Related Questions