3

What is the best way to remove Typescript asserts so that a production build created using npm run build is assert free?

Thank you

Reza
  • 18,865
  • 13
  • 88
  • 163
Olivierwa
  • 143
  • 1
  • 9

1 Answers1

1

The fastest solution I know is to use assert-plus on your project.

You can easily deactivate assertion according to your environment (production, development,..).

  • 2
    In my opinion when you deactivate the assertion thanks to the environment variable, the function is not removed but just content of the function return void. There is still a problem, the evaluation of the condition is still present in the call of `assert(condition)`. Did I miss something in the library ? – zagoa Mar 27 '20 at 14:15