My promises array is structured as follows:
export type PromisesArray = [
Promise<IApplicant> | null,
Promise<ICampaign | ICampaignLight> | null,
Promise<IApplication[]> | null,
Promise<IComment[]> | null,
Promise<{ status: number; message: IActionTag[] }> | null,
Promise<IHistoryEntry[]> | null,
Promise<IDocs> | null,
Promise<IForm> | null,
];
I aim to initialize it with an empty value like
const promisesArray = <PromisesArray>[]
.
But, I encounter this error message:
The conversion of type '[]' to 'PromisesArray' may be a mistake due to insufficient overlap between the types. To proceed intentionally, first convert the expression to 'unknown'.
Type '[]' lacks properties present in '[Promise<IApplicant>, Promise<ICampaign | ICampaignLight>, Promise<IApplication[]>, ...and more.]': 0, 1, 2, 3, and more.ts(2352)
Later on, when I attempt to add an item to the array:
If (this._printOptions[EPrintOption.Tags]) {
const applicantActionsTagsPromise = ApplicantService.getActions(this._applicantId);
promisesArray.push(applicantActionsTagsPromise); // This line triggers the error
} else {
promisesArray.push(null);
}
This results in the following error:
The argument 'Promise<IActionTag[]>' cannot be assigned to the parameter 'Promise<IApplicant> | Promise<ICampaign | ICampaignLight> | Promise<IApplication[]> | ...and more...'.
Type 'Promise<IActionTag[]>' is incompatible with type 'Promise<IApplicant>'.
Certain properties are missing from 'IActionTag[]' compared to 'IApplicant': address, advertiseid, applicantid, birthdate, and others.ts(2345)
I am seeking a resolution for this issue without resorting to using the 'any' type.