According to Webpack documentation:
It can be put in front of function calls to mark them as side-effect-free. Arguments passed to the function are not being marked by the annotation and may need to be marked individually.
Can we write PURE function at declaration ? Something like:
var max = /*#__PURE__*/(a,b) => { return (a>b)?a:b }
If yes, what is the right syntax?
As far as I know, there is no native way you can declare function as
purein JavaScript.TypeScript has a proposal to introduce
purekeyword for functions and methods, but currently this is just a draft. You can read the whole thread, if you want here. The thread contains a comment with draft proposal description. When and whether at all this idea will be implemented is very hard to say.