我有下面的類:傳遞角服務類和基礎類
export class CellLayer extends BaseLayer {
constructor(name: string, type: LayerType, private mapService: MapService) {
super(name, type, mapService);
}
}
和相應的抽象類:
export abstract class BaseLayer implements ILayer {
private _name: string;
private _type: LayerType;
constructor(name: string, type: LayerType, private mapService: MapService) {
this._name = name;
this._type = type;
}
}
全局MapService
對象應傳遞給這兩個類。
不過,我現在收到以下錯誤:
Types have separate declarations of a private property 'mapService'. (6,14): Class 'CellLayer' incorrectly extends base class 'BaseLayer'.