Answer the question
In order to leave comments, you need to log in
How to set types for dynamic properties of an object?
Hello!
There is such a function
render(element: string, args: RenderArgs = {}, pos: Pos = Pos.end): void {
for (let key in args) {
element = element.replace(new RegExp(`{{${key}}}`), args[key]);
}
this.mountElement.insertAdjacentHTML(pos, element);
}
export type RenderArgs = { [ key: string ]: number | string }
Answer the question
In order to leave comments, you need to log in
The problem was in this line
element = element.replace(new RegExp(`{{${key}}}`), args[key]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question