Renann
07/11/2020, 11:44 PM.d.ts
files (I don't use the generated javascript code!)
3. Create a typescript script which uses the .d.ts
4. Compile to javascript
5. Run in the GraalVM
The end result I'm looking for like a binding for my kotlin classes to be called from typescript.
I'm using latest kotlin version 1.4-M3.
Disclaimer I'm not expert in typescript (nor kotlin), but
I could do everything, however:
1. The generated typescript definition file doesn't export
module, so I cannot import in my typescript script
2. I added the export keyword to fix it
3. Now I can import the definition and use it, however in order to execute in GraaVM what I need is to import java types from javascript by using the Java.type
call instead of require
Now I would like to know if there's a way to modify the kotlin generator so that I could achieve transpilation from such imported types to javascript and be callable by GraalVM out of the box. Some guidance on this topic would nice and I believe at least the export
of the module should be part of the core kotlin generator.Renann
07/11/2020, 11:50 PMrusshwolf
07/12/2020, 12:24 AMbashor
07/13/2020, 1:17 PMRenann
07/13/2020, 1:25 PMbashor
07/13/2020, 1:28 PMbashor
07/13/2020, 1:30 PMbashor
07/13/2020, 1:31 PMRenann
07/13/2020, 1:33 PMbackend.js
to create something like backend.graalvmjs
would be the right path?Renann
07/13/2020, 1:34 PMpublic
you mean that the only way to use the compiler API would be forking kotlin itself?Renann
07/13/2020, 1:35 PMbashor
07/13/2020, 1:43 PMbashor
07/13/2020, 1:46 PMRenann
07/13/2020, 2:03 PM.d.ts
generated for this purpose and the one generated to call javascript.
To summarize:
1. compile kotlin
2. generate .d.ts
for those classes
3. use it from typescript
4. transpile to javascript
5. run in the graalvm (then it will be able to call the kotlin classes from javascript)Renann
07/13/2020, 2:14 PMd.ts
to generate in addition the graalvm's required Java.type
callsbashor
07/13/2020, 3:15 PMI’m not sure if there could be differences between theUnfortunately, ABI of generated code is platform dependent.generated for this purpose and the one generated to call javascript..d.ts
Renann
07/13/2020, 4:00 PM