But still I am having: ``` main.bundle.js:1 Uncaug...
# javascript
k
But still I am having:
Copy code
main.bundle.js:1 Uncaught (in promise) ReferenceError: JSONFormatter is not defined
    at P (main.bundle.js:1)
    at b (main.bundle.js:1)
r
Hi there, could you please provide a bit more information. At the first glance looks like it might anything 🙂 Probably that might be problem with modules. Which one are you using?
k
I am using commonjs but I tried also UMD, and it gives same error message
Actually the ts2kt was only generating me the binding for JSFormatterConfiguration interface, so I changed the declaration of JSFormatter in
.d.ts
file from class to interfase, and regenerated the biding
a
@kasper.kondzielski It seems you are using an NPM library, but the
external
declarations are marked with
@JsNonModule
annotations. That makes the compiler think that those classes could be referenced as is. What you probably want instead is `@JsModule`: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.js/-js-module/index.html . This annotation lets you tell the compiler, which NPM package contains the declaration. As a result the compiler generates appropriate
require
calls and imports those classes.
k
Ok, I will try that, thanks!