I'm learning angular and for best practice I think I need to add an interface to the output. The service DataFetchService is taking objects from an internal .json file. What is the best way to implement my interface to this code? Any resources on the matter are more then welcome
import { Component, OnInit } from '@angular/core';
import { DataFetchService } from '../userActions';
interface getDataInterface {
name: string;
surename: string;
}
@Component({
selector: 'app-data-from-server',
templateUrl: './data-from-server.component.html',
styleUrls: ['./data-from-server.component.css']
})
export class DataFromServerComponent implements OnInit {
users$: Object;
constructor(private data: DataFetchService) { }
ngOnInit() {
this.data.getData().subscribe(
data => this.users$ = data
)
}
}