#Expression "1" cannot be used to index the type "EventTarget
7 messages · Page 1 of 1 (latest)
@pearl raven You'll get better types if you use currentTarget, not target.
currentTarget is guaranteed to be the element the event is attached to, target could be a different element, due to bubbling.
You'll probably still need to do some cast on target[1] since that would be Element, a generic element, and you seem to be expecting it to be some sort of input element.
thx. for the recommendation
@latent iron i used this const description = (currentTarget[0] as HTMLInputElement).value and the error dissapear, but its a good solution?
Yeah, that's fine. as is making a "dangerous" assumption there, but I'm not sure how else you'd do it realistically.