how do we use kotlin to declare a `new` type of a ...
# javascript
h
how do we use kotlin to declare a
new
type of a variable? so for instance, if i have this code:
Copy code
val discord = require("discord.js")
// how can i declare 
val bot = js("new discord.Client();")
without losing type safety, as the
new
keyword doesn’t exist. is it in the kotlinjs lib? omitting the word throws an error
You'd have to either create an "external" class for
discord.Client
or see if the discord package has Typescript information (maybe via "Definitely Typed") you can import via ts2kt: https://kotlinlang.org/docs/tutorials/javascript/working-with-javascript.html#using-ts2kt-to-generate-header-files-for-kotlin
h
alright, thanks. never knew about this.