In the code snippet provided, there is a global type definition as follows:
declare global {
type ResponseData = {
opcode: number;
message: string;
data?: <WILL-CHANGE-ON-EACH-CASE>;
};
}
The goal is to assign a custom type to the data
field for specific return values. For instance:
interface AppInformation {
NAME: string;
VERSION: string;
}
// What should be defined as a return type???
export const getAppInfo = (): {...ResponseData, data: AppInformation } => {
return apiResponse.success(200, CONFIG.APP);
};
What should be defined as the return type for the getAppInfo
function?
The placeholder in the code gives an idea of the desired outcome.
Thank you in advance,