import { Component } from '@angular/core';
import { User } from './user';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
})
export class AppComponent {
constructor() {
const obj = {
firstName: 'Paresh',
lastName: 'Gami',
phoneNumber: 9726502930
};
// const objNew: User = {
// firstName: 'Paresh',
// lastName: 'Gami'
// };
// HERE Try to passing only 2 argument typescript gives you error instantly
this.setUser(obj)
}
setUser(obj: User) {
console.log(obj);
}
}