Solución
solution.tsTypeScript
// Implementa loadData usando funciones internas handleSuccess y handleError
// Si id > 0: retorna handleSuccess("dato-" + id)
// Si id <= 0: retorna handleError("ID inválido")
function loadData(id: number): string {
// Define handleSuccess y handleError aquí, luego úsalas
function handleSuccess(data: string): string{
return data;
}
function handleError(msg:string): string{
return msg;
}
if (id > 0){
return handleSuccess("dato-"+id);
}else if (id <=0){
return handleError("ID inválido")
}
}
export { loadData };0respuestas