andylamax
02/12/2022, 1:16 AM1.6.20-M1
. I gotta admint, @JsExport
got the love it truly deserves
Kudos to the whole team for such accomplishments. A lot of my issues (infact, all I have reported recently) have been already solvedankushg
02/12/2022, 1:54 AMandylamax
02/12/2022, 7:20 AMhfhbd
02/12/2022, 10:12 AMandylamax
02/12/2022, 9:12 PMexternal class is mapped to any
problem. Coz to me it works just fine
package battleground.problem
@JsExport
external interface User {
var name: String
var email: String
}
@JsExport
val pete: User = jso { }
Yields
export namespace battleground.problem {
interface User {
name: string;
email: string;
}
}
export namespace battleground.problem {
const pete: battleground.problem.User;
}
andylamax
02/12/2022, 9:15 PMPromise
called a Later
, it can be found here https://github.com/aSoft-Ltd/foundation/tree/master/foundation-runtimes/laterhfhbd
02/12/2022, 10:10 PMandylamax
02/13/2022, 2:32 AMUse a classThis code
package battleground.problem
@JsExport
external class Promise<T>
@JsExport
val promise: Promise<Unit> = TODO()
generates the following types
export namespace battleground.problem {
class Promise<T> {
constructor();
}
}
export namespace battleground.problem {
const promise: battleground.problem.Promise<void>;
}
Are you sure you tried that on 1.6.20-M1
?
However, I have noticed kotlin.js.Promise<T>
is indeed exported as any // kotlin.js.Promise<T>
andylamax
02/13/2022, 2:41 AM@JsExport
external class Promise<T> {
companion object
}
Does not compile. For it to compile, you either remove the companion object,
or @JsExport
You can't seem to have both and make it workhfhbd
02/13/2022, 11:10 AMPromise
class does not work with typescript interoperability, because it is not mapped to js.Promise
.andylamax
02/13/2022, 1:28 PMcopy
the type definition in kotlin.js.Promise
into a file that is not inside a package. This is indeed a workaround thoughGrégory Lureau
02/14/2022, 10:33 AM@JsExport
and external
on the same class? It's just for testing 1.6.20-M1 or I'm missing something?andylamax
02/14/2022, 10:49 AMWhat's the point to useIf you just declare it asand@JsExport
on the same class?external
external
the generated .d.ts
won't include its definitions. @JsExport
makes your external class types available in the generated .d.ts