我有一个像这样的组件
import { Component } from '@angular/core';
interface ItemBaseType {
foo: boolean;
}
interface ItemType extends ItemBaseType {
bar: boolean;
}
@Component({
selector: 'ac-foo',
template: `<div *ngIf="item.bar">Hello</div>`,
})
export class FooComponent {
public item: ItemType;
}
Run Code Online (Sandbox Code Playgroud)
我在 Angular 9 应用程序上启用了fullTemplateTypeCheck 和 strictTemplates,它在运行时引发异常ng serve:
类型“ItemBaseType”上不存在属性“bar”。
但bar存在于ItemType.
出了什么问题?
| 归档时间: |
|
| 查看次数: |
1795 次 |
| 最近记录: |