¿Cómo obtener el tipo de retorno de una función en flujo?
Con este ejemplo:
const myObj = {
test: true,
};
type MyType = typeof myObj;
const getValue = (): MyType => {
return myObj;
};
// how to do this??
type TheReturnType = getValue;
const nextObj: TheReturnType = {
test: false,
};
Me gustaría extraer eltype
que la función volverá, por lo que puedo reutilizar ese tipo. No se me ocurre ninguna forma de conseguirlo. Lo anterior no funciona.typeof getValue
devolverá la función.