Is it possible to do something like this in TypeScript?
interface IPerson {
name: string;
age: number;
}
declare class Map<T> {
get(name: keyof T): any // ? return type
}
Result I need
const map = new Map<IPerson>();
map.get("name"); // string
map.get("age"); // number
Map<string, IPerson>.keyof T, and each Value has type defined in incoming object type and depending of Key