Currently, the /* @__PURE__ */ annotation must be used individually on every returned value for a given call.
Could it be possible to allow using the annotation on a function, so all its executions and returned values are considered pure? Like in the following.
/**
* The function is pure, so if the result is not used, it can be removed.
*
* @__PURE__
*/
function addTwo(number) {
return number + 2;
}
// Will be removed
addTwo(4);
// Will be removed
const x = addTwo(3);
// This will be kept
export const y = addTwo(2);
I started the same discussion on the esbuild repository, which leaded me here since @evanw prefers not to do any takes unless they are a standarised feature.
Currently, the
/* @__PURE__ */annotation must be used individually on every returned value for a given call.Could it be possible to allow using the annotation on a function, so all its executions and returned values are considered pure? Like in the following.
I started the same discussion on the esbuild repository, which leaded me here since @evanw prefers not to do any takes unless they are a standarised feature.