With TypeScript, can I type a curried version of getProperty<T, K extends keyof T>
问题 Example from https://www.typescriptlang.org/docs/handbook/advanced-types.html function getProperty<T, K extends keyof T>(o: T, name: K): T[K] { return o[name]; // o[name] is of type T[K] } Curried version: function curriedGetProperty<T, K extends keyof T>(name: K): (o: T) => T[K] { return (o: T) => o[name]; // o[name] is of type T[K] } const record = { id: 4, label: 'hello' } const getId = curriedGetProperty('id') // Argument of type '"id"' is not assignable to parameter of type 'never'.