let child: HTMLElement = allChildren[i] as HTMLElement;

在别人代码中看到这一段 能解释一下as的作用吗?

as是ts的关键字,只是用来限制child的类型。
js没有强类型声明,不需要as。

ts中的as_前端