类型记录似乎能够推断递归函数的类型: * Typescript correctly infers the type is * const referencesSelf: () =>means recursion of the functionconst referencesSelf = () => {}; }
我有一个递归类型,它从嵌套的对象中提取索引,并将它们放在一个平面的强类型元组中,如下所示: type NestedRecord = Record<string, any>
type RecursiveGetIndexfoo", "bar", "baz"] 但是,当我试图在函数中使用递归类型时,我得到了一个递归错误: function doSomething<T extends NestedRecord>(arg: