Angular 在 Typescript 中标记为受保护的继承属性出现 5 个生产构建错误 - 'property does not exist on type' *Component

Angular 5 production build errors out on inherited properties marked as Protected in Typescript - 'property does not exist on type' *Component

Angular 5.2.8 打字稿 2.6.1 命令行界面 1.6.8

如果 运行 在正常开发模式下使用 ng serve,我的应用程序会生成构建文件。但是,当我 运行 `ng build --prod 我得到以下错误

Property 'status' is protected and only accessible within class 'ModuleBaseComponent' and its subclasses

但是属性 'status'是在ModuleBaseComponent中声明的字段。如果从 protected 更改为 public 就解决了,但是 protected 关键字有什么用呢!

export class ModuleBaseComponent {
protected status = 'inactive';
...
}

@Component({
  selector: 'app-themeA-preferences',
  templateUrl: './../common/my-common-theme.component.html',
  styleUrls: ['./my-themeA.component.scss']
})
export class MyThemeAComponent extends ModuleBaseComponent implements OnInit {}

Common html 必须依赖组件,只要这个特定的 html 是通过装饰器中的 templateUrl 引用的。那么继承就得弄清楚html.

中用到的变量

请大神指点一下

在 AOT 模式下编译时,您在模板中使用的属性必须 public。

Angular Docs:

The compiler can only reference exported symbols.

Decorated component class members must be public. You cannot make an @Input() property private or internal.

Data bound properties must also be public.