I have a global type as below:
declare global {
type ResponseData = {
opcode: number;
message: string;
data?: <WILL-CHANGE-ON-EACH-CASE>;
};
}
I want to put a custom type on data field in each specific returns.
For example:
interface AppInformation {
NAME: string;
VERSION: string;
}
// What should I put on a return type???
export const getAppInfo = (): {...ResponseData, data: AppInformation } => {
return apiResponse.success(200, CONFIG.APP);
};
What should I put on a return type of getAppInfo?
I leave something to get the idea of what I'm looking for.
Thanks beforehand,
ResponseDatato be generic like this (web IDE link), but the example code here isn't a minimal reproducible example so I'm not sure. Please consider modifying your example code so that it demonstrates what you're doing when dropped into an IDE without dependencies on undeclared values or types.