https://kotlinlang.org logo
#javascript
Title
# javascript
g

Gleb

02/24/2023, 4:18 AM
Hi all! Does anybody know if it's possible for generated TS file to preserve external types? What I mean by this: i have code
Copy code
@JsModule("my-module")
external class Foo

@JsExport
class Bar() {
   fun test(val foo: Foo): Foo {
     return foo
   } 
}
I expect for foo to have type
my-module.Foo
I.e. in d.ts it's simply imported on top of the file. Right now it's effectively not typed, because import is missed. Is there a simple way around that? I know I can probably do this with gradle task (especially considering I only have 1 external JS dependency), but is there a better way?
4 Views