I seem to be struggling with understanding Typescript
I expected the returned observable to have a method getTitle()
, but it seems to be missing. Instead, I am getting an object that resembles AttachableContentModel
without that particular method. What is happening?
export class AttachableContentModel extends AbstractPopupModel {
Url: string;
EmailAddress: string;
StreetViewUrl: string;
Images: Array<ImageModel>;
Videos: Array<VideoModel>;
Documents: Array<DocumentModel>;
getTitle(): string {
if (this.Name &&
this.DisplayName &&
this.Name !== this.DisplayName)
return this.Name + " (" + this.DisplayName + ")";
return this.Name ? this.Name : this.DisplayName;
};
Silly: string;
}
...
fecthAttachableContent(request: AttachableContentRequest): Observable<AttachableContentModel> {
return this.http
.postAsJson(`${environment.apiBaseUrl}attachablecontent`, {})
.map(res => res.json())
}