ERROR TypeError: Cannot set property ‘firstname’ of undefined at new UserComponent

I am new to Angular. I have created a simple UserComponent and in the class there is an Object named user which contains all the properties of a user like firstname , lastname , age ,email but when i try to access those properties in the class constructor and set their values i get an error in the console saying cannot set the property of firstname of undefined or cannot set property of lastname of undefined. i don’t know what the problem is. Here’s the code :

import { Component, OnInit } from '@angular/core';

  selector: 'app-user',
  templateUrl: './user.component.html',
  styleUrls: ['./user.component.css'],
export class UserComponent {
  user: {
    firstname: string;
    lastname: string;
    age: number;
    email: string;

  constructor() {
    this.user.firstname = 'Muhammad';
    this.user.lastname = 'Shaeel';
    this.user.age = 23; = '[email protected]';

Source: Angular Questions