Grégory Lureau
11/12/2021, 10:32 AMbuildIllegalArgumentException(msg: string): kotlin.IllegalArgumentException;But in VsCode it's handled as
any
, I suspect because the kotlin.XxxException are not exposed in the .d.ts.
Is there an option to make them defined/accessible for typescript?Grégory Lureau
11/12/2021, 10:59 AMexport namespace kotlin {
class Throwable {
constructor()
constructor(message: String)
constructor(message: String, cause: Throwable)
constructor(cause: Throwable)
readonly name: string;
readonly stack: string;
readonly message: string;
}
class Exception extends Throwable{
constructor()
constructor(message: String)
constructor(message: String, cause: Throwable)
constructor(cause: Throwable)
}
[...]
it works for name/stack/message but not enough to use instanceof ( ex instanceof kotlin.Exception
)
TypeError: Cannot read properties of undefined (reading 'Exception')
Have you already try something similar? Why is it not provided by KotlinJs?turansky
11/12/2021, 11:03 AMError
insteadGrégory Lureau
11/12/2021, 11:09 AMkotlin.Error
is also defined in stdlib-js but not exposed in the generated typescript, so I expect the same issue.Grégory Lureau
11/12/2021, 11:11 AMif (exception instanceof kotlin.IllegalArgumentException) doStuff()
Grégory Lureau
11/12/2021, 11:13 AMif (exception.name == "IllegalArgumentException") doStuff()
But then I cannot check for inheritance 😞Grégory Lureau
11/12/2021, 11:58 AMError
, typescript exposes
buildIndexOutOfBoundsException(msg: string): kotlin.Error;
with kotlin.Error
instead of Error
. 😞turansky
11/12/2021, 3:06 PMThrowable
in Kotlin == Error
in JS