Anyone know if there's a bug for this? I'm still s...
# javascript
m
Anyone know if there's a bug for this? I'm still seeing promises as non-exportable in 1.6.21.
h
It is exportable, but until 1.7.0 you need id("io.github.turansky.kfc.definitions") version "5.12.0" plugin: https://github.com/turansky/kfc-plugins https://youtrack.jetbrains.com/issue/KT-51205/K-JS-IR-external-class-is-mapped-to-any
m
Ohhhh thank you
@hfhbd do I need to configure the plugin or just apply it?
h
Applying is enough 🙂
m
Very nice. Does it add any code to the bundle?
h
Nope, in fact, it is only a regex removing
kotlin.js
prefix from your d.ts file
m
Cool
Messy little hack though
@hfhbd compiler still produces a warning after applying the plugin -- is this expected?
h
What warning?
JsExport
is still experimental
m
Exported declaration uses non-exportable return type: Promise<InitechCloudResponse<OrganizationAccount>>
Both
OrganizationAccount
and
InitechCloudResponse
are marked with
@JSExport
Copy code
public fun createAccount(
        organizationIdOrAlias: String,
        body: CreateOrganizationAccount
    ): Promise<InitechCloudResponse<OrganizationAccount>> {
        return scope.promise {
            initechCloudClientDelegate
                .createAccount(organizationIdOrAlias, body)
        }
    }
Here is the function in question
h
It's JavaScript... You could ignore the error 😄 But are you sure, both classes uses @JsExport and are exportable? If not, the types are mapped to any. Just look into your d.ts file
m
Yeah I'd ignore the error but excessive warnings like this make it easy to overlook other warnings that actually matter
Both classes definitely have
@JsExport
on them but I'll try the other thing.