___anj___
___anj___
Explore posts from servers
NNuxt
Created by ___anj___ on 5/27/2024 in #❓・help
Typing dynamic template refs in a loop
I could just slap the as keyword:
return refs[`carouselItem${props.activeIndex}`] as HTMLElement;
return refs[`carouselItem${props.activeIndex}`] as HTMLElement;
And red squiggly lines will magically go away. But I'm not sure if it is really correct typing and anyway I want to avoid using as as much as possible (pun not intended). Do you have an idea how to overcome it? What would be a good refactor to make here?
2 replies