I want to do this code with kotlinJS : ``` const ...
# javascript
m
I want to do this code with kotlinJS :
Copy code
const point = new lib.Point(x, y)
I tried :
Copy code
val lib = require("lib")
val point = lib.Point(x, y)
I got an error because KotlinJS generate this :
const point = lib.Point(x, y)
How to force a new ?
a
m
It's to write facade for JS lib ? How to use it here ? With JsModule ?
a
it is used to describe the JS API so that Kotlin knows what is what, e.g. that Point is a class, not a function
w
Copy code
@JsModule("lib")
external class Point(x: Float, y: Float)