所以我遇到了这个错误
ERROR in src/app/main/select-activity-typ
e/select-activity-type.component.ts(87,11
): error TS2322: Type '{ activity: any; h
eader: string; activities: ({ activityNam
e: string; available: false; link: str...
' is not assignable to type 'ActivitySele
ction'.
Property 'activityName' is missing in t
ype '{ activity: any; header: string; act
ivities: ({ activityName: string; availab
le: false; link: str...'.
src/app/main/select-activity-type/select-
activity-type.component.ts(115,9): error
TS2322: Type '{ activity: any; header: st
ring; activities: ({ activityName: string
; available: false; link: str...' is not
assignable to type 'ActivitySelection'.
Property 'activityName' is missing in t
ype '{ activity: any; header: string; act
ivities: ({ activityName: string; availab
le: false; link: str...'.
src/app/main/select-activity-type/select-
activity-type.component.ts(143,9): error
TS2322: Type '{ activity: string; header:
string; activities: ({ activityName: str
ing; available: false; link: ...' is not
assignable to type 'ActivitySelection'.
Property 'activityName' is missing in t
ype '{ activity: string; header: string;
activities: ({ activityName: string; avai
lable: false; link: ...'.
src/app/main/select-activity-type/select-
activity-type.component.ts(171,9): error
TS2322: Type '{ activity: string; header:
string; activities: ({ activityName: str
ing; available: false; link: ...' is not
assignable to type 'ActivitySelection'.
Property 'activityName' is missing in t
ype '{ activity: string; header: string;
activities: ({ activityName: string; avai
lable: false; link: ...'.
当我运行ng服务时,现在从外观上看,它与activitySelection有关
在我的component.ts中
activity = {
activity: Something,
activityName: 'something',
activityTypeName: 'somethingsomething',
header: 'SOMETHING',
activities: [
{
activityName: 'Pre-Activity',
available: false,
link: ''
},
{
activityName: 'Today',
available: true,
link: '/app/main/etc'
}
]
};
...
这是我的界面
export interface ActivitySelection {
activity: string;
activityName: string;
activityTypeName: string;
header: string;
activities:
{
activityName: string;
available: boolean;
link: string;
}[];
}
我不确定是什么问题?我已经正确实现了接口?
我们将不胜感激!