Reputation: 8960
I'm trying writing an interface to figure to handle data like this:
interface SessionList {
appInfo: Object(string: string | null);
}
There could be 0 to many items under appInfo. I'm trying to find the correct syntax but not luck - currently at:
appInfo: Object(string: string | null);
Any ideas?
Upvotes: 5
Views: 2026
Reputation: 10127
Either
interface AppInfo {
[key: string]: string | null;
}
Or
Record<string, string | null>
Update:
let obj: { appInfo: Record<string, string | null> };
interface SessionList {
appInfo: Record<string, string | null>;
}
let obj: SessionList;
Upvotes: 10