问题
So I understand that with TS 2.4 we get trickter generic checks. But what I don't understand is why now I get with this:
getChannelBlockModels(i_campaign_timeline_chanel_id): Observable<List<CampaignTimelineChanelPlayersModel>> {
return this.store.select(store => store.msDatabase.sdk.table_campaign_timeline_chanel_players)
.map((campaignTimelineChanelPlayersModels: List<CampaignTimelineChanelPlayersModel>) => {
return campaignTimelineChanelPlayersModels.filter(campaignTimelineChanelsModel => {
return campaignTimelineChanelsModel.getCampaignTimelineChanelId() == i_campaign_timeline_chanel_id;
})
}).take(1);
}
this error:
Error:(806, 9) TS2322:Type 'Observable<Iterable<number, CampaignTimelineChanelPlayersModel>>' is not assignable to type 'Observable<List<CampaignTimelineChanelPlayersModel>>'.
Type 'Iterable<number, CampaignTimelineChanelPlayersModel>' is not assignable to type 'List<CampaignTimelineChanelPlayersModel>'.
Property 'set' is missing in type 'Iterable<number, CampaignTimelineChanelPlayersModel>'.
as I am returning Observable<List<CampaignTimelineChanelPlayersModel>>
so why isn't TS happy?
来源:https://stackoverflow.com/questions/45153925/why-is-the-new-generics-in-typescript-2-4-causing-this-to-fail