5

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?

1 Answer 1

10

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;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.