Actual Behavior / Situation
Rollup and Terser can use the annotations /*@__PURE__*/ and /*#__PURE__*/ to mark functions as pure or impure.
Rollup, WebPack, and Terser can also declare purity of entire files using sideEffects and usedExports declarations in a config file or package.json.
Expected Behavior / Situation
Usage of standard JSDoc annotations to specify function purity.
Google Closure Compiler uses @nosideeffects and @modifies {this|arguments} annotations to specify a function's state mutation. They do, however, have to be defined using an extern.
Modification Proposal
Replace /*@__PURE__*/ and /*#__PURE__*/ with @nosideeffects and @modifies {this|arguments} annotations. This is more accurate, idiomatic, and more finely grained than the current approaches.
P.S. You might also be interested in @noalias, @nocompile, @nocollapse, @noinline, or @private.
Actual Behavior / Situation
Rollup and Terser can use the annotations
/*@__PURE__*/and/*#__PURE__*/to mark functions as pure or impure.Rollup, WebPack, and Terser can also declare purity of entire files using
sideEffectsandusedExportsdeclarations in a config file or package.json.Expected Behavior / Situation
Usage of standard JSDoc annotations to specify function purity.
Google Closure Compiler uses
@nosideeffectsand@modifies {this|arguments}annotations to specify a function's state mutation. They do, however, have to be defined using an extern.Modification Proposal
Replace
/*@__PURE__*/and/*#__PURE__*/with@nosideeffectsand@modifies {this|arguments}annotations. This is more accurate, idiomatic, and more finely grained than the current approaches.P.S. You might also be interested in
@noalias,@nocompile,@nocollapse,@noinline, or@private.