Sebastian
07/06/2022, 9:21 AM/* kotlin.collections.List<any/* com.company.manager.data.ApiAnswer */> */
). The inner comment closing statement (*/
) will make the outer comment closing appear as regular code and thus generate a syntax error in TypeScript. I’ll put a slightly more complete example in the thread.
Did anyone have any issues like that, or is there any related entry in the issue tracker? I haven’t found anything so far, but can’t imagine that I’m the only one with totally broken TypeScript definitions. 🤔@JsExport
@ExperimentalJsExport
public class Manager(
private var proxyKey: String,
private var countryAlpha2: String,
) {
public companion object {
public fun build(proxyKey: ProxyKey, countryAlpha2: String): Manager =
Manager(proxyKey.name, countryAlpha2)
}
public fun currentAnswers(): List<ApiAnswer> {
return someSerializer.convertResponseToApiAnswers(response)
}
}
Generated Typescript definition (manager.d.ts
):
export namespace com.company.manager {
class Manager {
constructor(proxyKey: string, countryAlpha2: string);
static get Companion(): {
build(proxyKey: any/* com.company.manager.common.ProxyKey */, countryAlpha2: string): com.company.manager.Manager;
};
currentAnswers(): any/* kotlin.collections.List<any/* com.company.manager.data.ApiAnswer */> */;
}
}
→ The nested comments inside the method signature of currentAnswers()
are not valid TypeScript syntax and break everything that comes after the */>
.