1

I'm attempting to write a wrapper for an npm package but I cannot figure out how to define classes within a module in a separate file. It works fine if I do it within the single class but the file will end up being huge and messy if I go that route...

Imagine for example, there is this index.js file in the npm package:

module.exports = {
    AnotherClass: require('./somePath/AnotherClass')
}

Which I can do as:

@JsModule("testmodule")
@JsNonModule
external class TestModule {
    class AnotherClass {
        val someProperty: Type
    }
}

But I want to define AnotherClass in a separate (kotlin) file, just for better organisation and ease of navigation.

I've attempted (for sake of the example): @JsModule("testmodule/AnotherClass") as well as @JsModule("testmodule/somepath/AnotherClass") neither of which appear to work.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.