What should be the type of name so that the function getValue only allows for one of Data key types as it argument.
CodePudding user response:
Have you tried keyof Data for the name argument? You can do it like
const getValue = (name: keyof Data) => data[name];

