// ts中可以使用 typeof 获取 变量的类型 const str:string = "foo" function echo(arg:typeof str):string { return arg } // 如何获取echo函数的返回值类型?const bar :typeof echo = '1' // ERROR // 不能将类型“"1"”分配给类型“(arg: string) => string”。vue.jsnode.js前端javascriptty...
// ts中可以使用 typeof 获取 变量的类型 const str:string = "foo" function echo(arg:typeof str):string { return arg } // 如何获取echo函数的返回值类型?const bar :typeof echo = '1' // ERROR // 不能将类型“"1"”分配给类型“(arg: string) => string”。vue.jsnode.js前端javascriptty...
// ts中可以使用 typeof 获取 变量的类型 const str:string = "foo" function echo(arg:typeof str):string { return arg } // 如何获取echo函数的返回值类型?const bar :typeof echo = '1' // ERROR // 不能将类型“"1"”分配给类型“(arg: string) => string”。vue.jsnode.js前端javascriptty...