So I've been working with this data structure
export interface StoreData {
msdb: {[tableName: string]: List<StoreModel>};
}
However, I'm looking to restrict and enable auto-completion for specific string values in my tableName field. I attempted the following approach but it didn't succeed:
var tableNames:'table_campaigns' | 'table_resources'
export interface StoreData {
msdb: {[tableName]: List<StoreModel>};
}
I also tried the following without any luck:
interface IMyTables {
'table_campaigns: string
'table_resources: string;
}
type MyTables = keyof IMyTables;
export interface StoreData {
participants: { [key: number]: any };
threads: { [key: number]: any };
messages: { [key: number]: any };
msdb: {MyTables: List<StoreModel>};
}
I attempted something else as well:
type allMyTables = 'table_campaigns' | 'table_resources'
export interface StoreData {
msdb: {[tableName: allMyTables]: List<StoreModel>};
}
Thanks for taking the time to read,
Sean