我有一个带有三个泛型参数的接口,如下所示 interface X<A,O,I> {} 我想创建一个函数,它接受这些接口的数组作为rest参数,这样O和I的类型是相同的,但A的类型可以变化。此外,我希望返回类型是A的所有类型的联合。want the return type for this to be 'Type1 | Type2
在TypeScript中,有没有办法键入以下fn函数,以便TypeScript仍然知道result的类型是'hello' const hello = 'hello' // hello is of type'hello'
const result = fn(hello) // result is of type unknown 对于泛