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

0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.