let declineYears = (num: number) => {
let arr = ['год', 'года', 'лет'];
return `${num} ${arr[(num % 100 > 4 && num % 100 < 20) ? 2 : [2, 0, 1, 1, 1, 2][(num % 10 < 5) ? num % 10 : 5]]}`
};
function trueRussianDecline(d1, d2, d3, c){
let res = "";
switch (c%100){
case 11: case 12: case 13: case 14:return d1;
default:
switch (c%10){
case 0:case 5:case 6:case 7:case 8:case 9:return d1;
case 1: return d2;
case 2:case 3:case 4: return d3;
}
}
return "";
}
let text = trueRussianDecline("лет","год","года",5);