I'm attempting to transform the received numerical status into a corresponding string for the user interface like this:
{statuses[job.status]}
const statuses = {
1: "Processing",
2: "Done",
3: "Aborted",
4: "Queued",
}
However, I am encountering the following error:
No index signature with a parameter of type 'number' was found on type '{ 1: string; 2: string; 3: string; 4: string; }'
I have attempted to address this by introducing an interface, but the issue persists
interface IStatus {
1: string;
2: string;
3: string;
4: string;
}
const statuses = {
1: "Processing",
2: "Done",
3: "Aborted",
4: "Queued",
} as IStatus;
I have explored various solutions to this problem, but have been unsuccessful in resolving it in my particular case.