interface Keys { [key: string]: any } const obj: Keys = { trimDescription(text: string, length: number): string { return text.length > length ? text.substrin
interface Keys { [key: string]: (text: string, length: number) => string; } const obj: Keys = { trimDescription(text: string, length: number): string { return text.length > length ? text.substring(0, length - 3) + '...' : text } } Object.keys(obj).forEach(key => { console.log(obj[key]) })