Answer the question
In order to leave comments, you need to log in
How to resolve assignment?
Hello everyone
There is an object with this type
private handlers: { [key: string]: Function | Function[] } = {};
if(Array.isArray(this.handlers[handlerId])) this.handlers[handlerId].push(handler);
else {
let handlers = [ this.handlers[handlerId], handler ];
this.handlers[handlerId] = handlers;
}
if(Array.isArray(this.handlers[handlerId])) this.handlers[handlerId].push(handler);
this.handlers[handlerId] = handlers;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question