I have ```Exported declaration uses non-exportable...
# javascript
d
I have
Copy code
Exported declaration uses non-exportable property type: List<Carousel>
and
Copy code
data class Data(
    val carousel:List<Carousel>
)
Carousel itself is marked with @JsExport as well, am I not able to export lists?
It does appear to be correctly generating the
d.ts
?
Copy code
class Data {
        constructor(carousel: kotlin.collections.List<models.Carousel>);
        readonly carousel: kotlin.collections.List<models.Carousel>;
        component1(): kotlin.collections.List<models.Carousel>;
        copy(carousel: kotlin.collections.List<models.Carousel>): models.Data;
        toString(): string;
        hashCode(): number;
        equals(other: Nullable<any>): boolean;
    }
b
I think it would be simpler to use from JS/TS if you use Array in such API.
d
Yeah, that's what I ended up doing
b
Kotlin’s List is not exportable now.
d
If I pulled in kotlin std in JS, it should have kotlin.list right?
b
what do you mean?
d
https://kotlinlang.org/docs/reference/collections-overview.html In JS, if you pull in kotlin std lib you should be able to use the
List<T>
right? or am I mistaken
b
You can use it from Kotlin code, but not from JS side now, since collections are not exported.
^^ it’s only about the new JS compiler
In general, for API designed to use from JS it’s better to use Kotlin types mapped to JS “primitives” and your own types.
d
nice help
very detailed and has a solutiopn 🙂