property = unwrapFirstProperty<MyResponse<'SOME_RESPONSE'>>(response); // of type any for some reason Typescript我可以做些什么来确保Typescript预测正确的类型?如果我在对象上展开一个属性,就只剩下对象的唯一值了,对吧? Reproduced on the TS Playground
还在试着把我的脑筋转到typescript上。我尝试输入一个非结构化对象,如下所示: const { authError }: {authError: string} = useRouterQuery() authError必须是字符串才能与其他组件很好地协同工作因此,我得到以下typescript错误:Property 'authError' is missing in type 'ParsedUrlQuery' but required in type '{