We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
interface Person{ name:string, age:number } // 函数不显示设置返回值的类型,利用动态推导得出 function demo<T extends object, K entends keyof T>(obj:T, key:K){ return obj[k] } //测试 let obj:Person={ name:"tea", age:23 } let age = demo(obj, "age") // number类型 let name = demo(obj, "name") // string类型
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: