On Sun, Jan 24, 2021 at 8:17 PM Vassilis Virvilis <email@example.com> wrote:
I asked here one or two times but IIRC the answer was there should be an automatic way to import js libraries. Maybe through DefinitelyTyped typescript https://github.com/DefinitelyTyped/DefinitelyTyped definitions? not sure if it is even possible.
However you could rarely take an off-the-shelf typescript library and import it into the mix as tsickle was usually on an older version of typescript or the library was not completely typed or it used some typescript features not supported by tsickle. This usually meant that the library had to be patched and/or was not stripped of unused code and/or was not optimized etc. We often ended up writing our own library event when there was an equivalent available in the js ecosystem. (Which is no different to what we have to do with java-to-js solutions but generally the tooling available for long term maintenance is less good for js than for java). Even when all the stars aligned we often found that closure could not detect some code was unused due to the way js works and so we had to patch code so we could eliminate unused code by changing how we used a library. This is probably one of the reasons we ended back writing code in java. We could not use the existing ecosystem and had to work with a limited ecosystem if we wanted high-quality, minimized code .
So while it may be possible to use existing libraries from typescript and/or DefinitelyTyped, unless the typing is 100% then bugs will creep in and you won't be able to eliminate unused code. Where we are using js libraries we tend to write our own bindings or we just rewrite the functionality we need in java and get all the benefits provided by the compiler.
I am not aware of such a way or at least a roadmap. Do you think that with the WASM target the jsinterop binidings will be more automatic / easier / less manual?
WASM is still a moving target and I haven't tracked it of late ... but there were specs that defined the inter module API which would be trivial to automatically generate bindings for. There was also primitive tooling that did dead code elimination and optimization between modules (by essentially removing the unused API ingress and re-running intra module optimizer to strip dead code) but I don't know how good it is. I don't know if it will ever be possible to do whole application optimization and combining into a single module but I am not sure that will be much of a problem in practice. At least not for languages that do not have much overhead during compilation.
Anyhoo - it will be an interesting time regardless.
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firstname.lastname@example.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/CACiKNc7Z%3DC3F0cXTggkPhPFeh8%3D5M%3DYpE45%3DWfnCWJzSaBFGgw%40mail.gmail.com.