typescript - 如何在不指定参数的情况下调用泛型方法,该方法将返回数组中与类型匹配的每个元素
我刚接触 TypeScript,我想知道是否有方法可以让我调用类似 .getComponent<Transform>() 的函数,在该函数内部我能够检测我在 <> 内输入的类型,并检查数组中是否有该类型/实例的项目?谢谢
.[1]: https://i.sstatic.net/wDonf.png [2]: https://i.sstatic.net/4dDhj.png
网站搜索
我刚接触 TypeScript,我想知道是否有方法可以让我调用类似 .getComponent<Transform>() 的函数,在该函数内部我能够检测我在 <> 内输入的类型,并检查数组中是否有该类型/实例的项目?谢谢
.[1]: https://i.sstatic.net/wDonf.png [2]: https://i.sstatic.net/4dDhj.png