0

I have the following code snippet:

"foo".length > 0 ? true : false;

Does the Angular compiler replace it just with true?

tsc does not do; I tried it out.

daflodedeing
  • 319
  • 3
  • 11

1 Answers1

1

That's the job of the minifier, noy the compiler.

For example Esbuild (a bundler used by angular) will do that for you:

echo '[1].length > 0 ? true : false' | esbuild --loader=ts --minify
> [1].length>0;
Matthieu Riegler
  • 31,918
  • 20
  • 95
  • 134