Wednesday, October 11, 2017

Re: Exposing GWT components based on Elemental2 to TypeScript ?

Is there any tentative release date for j2cl ? I was not present at the GWTCon, maybe it was mentioned there ? Or is it the typical "It will be released when it is ready" approach ?

Thanks for the links.

I must say that I kinda hate TypeScript and I prefer Java and GWT. But hey, other people seem to have a different opinion.



On Tue, 10 Oct 2017 at 19:16, Thomas Broyer <t.broyer@gmail.com> wrote:

On Tuesday, October 10, 2017 at 5:12:51 PM UTC+2, DavidN wrote:
I'm currently investigating how to expose a GWT based component (that uses JsInterop and Elemental2) to JavaScript and TypeScript.
The goal is that this component should be reusable in an Angular 4 application, but also in GWT applications.

I think you'll be delighted by J2Cl when available, and then use Clutz and/or Gents (https://github.com/angular/clutz) for TypeScript interop (see also https://github.com/material-components/material-components-web/issues/134 )

I'm finding it really hard to create a .d.ts file that is acceptable to Angular 4 (documentation and reality seem to clash).

I was wondering, am I the first to try this ? 
For now I gave up on the attempt to declare a proper .d.ts file and just declared the reference as any.
But somehow I think it would be nice if GWT had a linker that could actually output that TypeScript file automatically saving me from doing double work.

You could possibly use an annotation processor to do that (processing all jsinterop.annotations.* annotations)
 
I am using the sso-linker in GWT to get all my JsType classes exported and I just load the generated nocache.js file.
Is there a way to make sure that the contents of that file does not cache with other JS objects ? 
Can I somehow declare at compile time what I want to have exported ?

Yes, through -includeJsInteropExports and -excludeJsInteropExports patterns (added in 2.8.1)

There seems to be more in the output than what I actually need (I don't need an EntryPoint for example).

The entry point is required in GWT, but can be empty / no-op if you export JsInterop types.

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment