I want to declare an array object in typescript like this:
export async function getInitialState(): Promise<{
settings?: Partial<LayoutSettings>;
currentUser?: API.CurrentUser;
loading?: boolean;
dictionary?: Dictionary[];
fetchUserInfo?: () => Promise<API.CurrentUser | undefined>;
fetchDictionary?: () => Promise<API.DictionaryList | undefined>;
}> {}
but the visual studio shows error:
Cannot find name 'Dictionary'.ts(2304)
I have already declared Dictionary in context like this:
declare namespace API {
type Dictionary = {
key,
value,
dict_type,
};
}
why still tell that could not found the Dictionary? is it possible to declare an array object type in typescript?
Dictionarylike:Api.Dictionarysince it belongs to theApinamespace.