Cannot assign a 'protected' constructor type to a 'public' constructor type.
Closed this issue · 2 comments
tmichalec commented
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
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
Fixed in version 1.0.14.