The biggest impact that type information can have on output code size is due to disambiguation.
Most of the compiler's optimization passes completely ignore type information.
However, if disambiguation is enabled then type information will be used to rename logically distinct properties that have the same name so they will be clearly different.
For example, if you have a `Foo` class and a `Bar` class that are not related, and they both have a method named `doSomething()` the disambiguation pass
will rename them to something like `Foo$doSomething` and `Bar$doSomething` so that later passes will know for certain they are different and can optimize them independently.
This could lead to one of them being completely removed as unused or parameters that are unused in one being optimized away without affecting the other.
When this works it can be a really big win for code size.
If I understand you correctly, you're working on a JS library that you expect full applications to use by compiling it in with their own code, maybe with closure-compiler, maybe not.
I'm curious to know how you achieve this level of flexibility. Compilation with closure-compiler almost demands that you use `goog.module` to set up dependencies between
your source files, and once you've done that you have to compile it with closure-compiler to get working code.
If instead you mean you expect to provide your library in an already compiled form and the client applications will side-load it at runtime,
you'll need to make sure closure-compiler doesn't rename the globals and properties you intend to be public by using an externs file.
closure-compiler was designed with the assumption that the result of its compilation is a full application, so it feels free to rename anything that isn't clearly imported from outside of the sources it can see.
Best regards,
Bradford