Angular 4 - Http to HttpClient - property 'someproperty' does not exist on type Object

You can specify the type that is being returned, using an interface, class, etc. For example, you can use something like the following:

return this.http.get<Sidebar>('http://localhost:3000/sidebar/edit-sidebar');

As an example, Sidebar might be defined as:

interface Sidebar {
    _id: string;
    content: string;

See Typechecking the response from the Angular docs for further information:

...TypeScript would correctly complain that the Object coming back from HTTP does not have a results property. That's because while HttpClient parsed the JSON response into an Object, it doesn't know what shape that object is.

HttpClient parse automatically the JSON response to an Object and the shape of that object is not known, that's why Typescript show this error

alternative solution, using bracket notation:

this.sidebarService.getSidebar().subscribe(sidebar => {
 this.sidebar = sidebar["content"];

You can assign the variable(sidebar) an interface to explicitely tell what it will get or assign to it so it doesnt throw compile time error.

this.sidebarService.getSidebar().subscribe((sidebar: any) => {
                        this.sidebar = sidebar.content;