先阅读这个问题可能会有所帮助:How to copy the structure of one generic type to another generic in TypeScript?给定以下输入类型: interface InputType { surname: string; age: OutputValue&l
我试图在typescript中创建一个函数,该函数返回一个必须扩展给定接口的对象,但我希望该函数返回所创建对象的真实类型。原因是函数中的对象可能会在未来发生变化,我希望确保它始终具有接口中所需的最少道具。should be of type {a: string, b: number}, or the more concrete
我有以下响应类型,我正在尝试使用unwrapFirstProperty函数对其进行分解。property = unwrapFirstProperty<MyResponse<'SOME_RESPONSE'>>(response); // of type any for some reason Typescript认为函数的返回类型是any而不是{ message: string; statu