Element implicitly has an ‘any’
function proxify(obj: any) {// 解决办法:可一个给 res 赋值为 any 类型//let res = {};let res:any = {};for (let k in obj) {// Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.No index signature with a parameter of type 'string' was found on type '{}'.res[k] = {set() { },get() { }}}return res;}
Type ‘Proxy’ is not generic.
// 报错原因是 Proxy 没有设置泛型type Proxy = {name: string,age: number};type Proxify<T> = {// Proxy<T[P]> 报错 Type 'Proxy' is not generic.[P in keyof T]: Proxy<T[P]>};
解决办法
type Proxy<T> = {name: string,age: number};
