export type Entry = {
pagename: string;
path: string;
datasource: string;
};
export type BunchOfEntrys = {
[key: string]: Entry;
};
export const BunchOfEntrys: BunchOfEntrys = {
NAME_1: {
pagename: 'Name 1',
path: 'path/name1',
datasource: 'data_name_1',
},
NAME_2: {
pagename: 'Name 2',
path: 'path/name2',
datasource: 'data_name_2',
},
} as const;
If I type the BunchOfEntrys with BunchOfEntrys, the intellisense is lost. If I remove the type, it’s back. How can I safely type my const Object and also get intellisense?
I want to be able to enter a new entry, e.g. “NAME_3”, and then use it in the rest of my repo with intellisense.