Kotlin / dukat

Converter of <any kind of declarations> to Kotlin external declarations
552 stars 42 forks source link

Unable to convert three.js #166

Open zlepper opened 7 years ago

zlepper commented 7 years ago
Converting node_modules/@types/three/index.d.ts
ts2kt: "ExportDeclaration" kind unsupported yet here! (node_modules/@types/three/index.d.ts:1:1 to 6:30)
ts2kt: "ExportDeclaration" kind unsupported yet here! (node_modules/@types/three/index.d.ts:6:30 to 8:40)
ts2kt: "ExportDeclaration" kind unsupported yet here! (node_modules/@types/three/index.d.ts:8:40 to 9:39)
...

Specific code it's complaining about is code like this: export * from "./three-core";

And likely also: export as namespace THREE;

ammachado commented 6 years ago

The same problem happens with Angular. @bashor, can you give me some advice of where to start looking to deal with this bug?

bashor commented 6 years ago

Hi, @ammachado! Sorry for the delay!

In general:

  1. Usually, it's useful to look at the code to understand which syntax is unsupported. For that, you can use path, line and column information from the output.
  2. Next, you can simply understand where from it was reported by running the converter with additional options: -Xdiagnostic-level WARNING_WITH_STACKTRACE
  3. Now we have to decide that we want to generate in Kotlin for this construction
  4. And just implement it! :)
bashor commented 6 years ago

Looks like we have to consider few cases for exports:

For the first probably we just should generate right annotations. For more information take a look at references, at least here and here For the second -- I don't know yet how to support it better. (You can just skip it now)

ammachado commented 6 years ago

Hi @bashor,

To me, it seems that the problem lies in the second case, as you pointed out in your last comment. I have a failing test case on my fork for that.

bashor commented 6 years ago

Do you have any idea about what we should generate for this case?

ammachado commented 6 years ago

I was thinking about "rewriting" the export directive to do something more like a server side include do. That's where I'm stuck at.

bashor commented 6 years ago

I'd find more use cases and trying to write required code manually to get a better understanding.