Answer the question
In order to leave comments, you need to log in
How to overload parent method?
The parent class has a method:
public getDiaryWeekDay(item: ILessons): string {
const dateObj = Helper.formatDate(Object.keys(item).shift(), 4);
return dateObj['n'];
}
public getDiaryWeekDay(date: string): string {
return Helper.formatDate(date, 4)['n'];
}
Answer the question
In order to leave comments, you need to log in
There is no (explicit) method overloading in javascript, so in typescript it is very truncated, taking into account the capabilities of js.
In your case, you can change the parent method to:
public getDiaryWeekDay(item: ILessons | string): string {
// придется добавить проверку на то, что item - объект
const dateObj = Helper.formatDate(Object.keys(item).shift(), 4);
return dateObj['n'];
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question