lagoshny / ngx-hal-client

Spring HAL client for Angular
21 stars 15 forks source link

Cannot assign a 'protected' constructor type to a 'public' constructor type. #5

Closed tmichalec closed 4 years ago

tmichalec commented 4 years ago

Hello,

I just trying sample from README and I get this error:

error TS2345: Argument of type 'typeof Team' is not assignable to parameter of type 'new () => Team'. Cannot assign a 'protected' constructor type to a 'public' constructor type.

export class TeamsService extends RestService<Team> {
  constructor(injector: Injector) {
    super(Team, 'teams', injector);
  }

If I create public empty constructor, it works without error.

export class Team extends Resource {

  ...

  constructor() {
    super();
  }
}

Why is constructor on RestService protected?

lagoshny commented 4 years ago

Hi @tmichalec,

Yes you are right, protected constructor for Resource class is not necessary. I think this mistake was did when changing project structure. Will fix it in new release.

lagoshny commented 4 years ago

Fixed in version 1.0.14.