Refactoring the code ...

First, create a new class named Comment in a file named comment.ts in the shared folder and include the following in it:

export class Comment {
  rating: number;
  comment: string;
  author: string;
  date: string;
}

Here, we define the properties of this Comment class.
The first property is rating which is a number.
The second property is comment which is a string.
The third property is author which is a string.
The last property is date which is also a string.