I'm trying to add an external class to access `lin...
# javascript
e
I'm trying to add an external class to access
linkedom/xml/XMLDocument
, as per screenshot. What would be the correct way to do it?
a
I would add it as:
Copy code
// FILE: XMLDocument.kt
@file:JsModule("linkedom/xml/XMLDocument")
package linkedom.xml

external class XMLDocument
gratitude thank you 1
e
> Package subpath './xml/XMLDocument' is not defined by "exports" Seems like this class wasn't meant to be accessible by users
a
You mean from the perspective of the
linkedom/xml/XMLDocument
library developers, or your users of the Kotlin code shouldn't have access to the class?
e
Oh I meant from the linkedom devs perspective. It appears it's only used internally and not meant to be created or seen externally.
I wanted to create a new
XMLDocument
without the parsing stage. But I ended up doing it like this:
Copy code
val document = domParser.parseXmlFromString("<$rootTagName/>")
a
I see. In this case you still can use it like I mentioned above, but if the structure of project is changed or the class is removed you will need to rework. If you ask me, I would use only public API 😄
e
Yup agree, I'll keep it simple. Off topic but just wanted to see if it's still on your radar: we plan to ship the npm packages to be used by JS/TS consumers. Not now but probably Q2 2024. Is documentation still planned to be added to generated d.ts files?
a
So, we already add
deprecated
TS-doc to declarations with the
Deprecated
annotation, but adding comments is much harder to do in the current compiler architecture. We are looking the way to do it, but it's not something that we could ship the nearest 2 quarters.
e
Ok, that's good to know so I can adjust our plans, thanks!