S.
11/19/2024, 5:29 PM[NON_EXPORTABLE_TYPE] Exported declaration uses non-exportable return type: 'arrow.core.Either<A, B>'
when I add @JsExport
to a class containing an Either. same for NonEmptyList
. Is there any possible solution to this?Alejandro Serrano.Mena
11/20/2024, 10:14 AM@JsExport
to every class in arrow-core
?S.
11/20/2024, 10:17 AM@Serializable
as well while you're at it 😅S.
11/20/2024, 10:18 AM@JsExport
. I merged the back and frontend repos and directly import the modules now instead of a maven library and this fixes itAlejandro Serrano.Mena
11/20/2024, 10:18 AMarrow-core-serialization
S.
11/20/2024, 10:20 AMEither
I needed to wrap it into a serializable class itselfAlejandro Serrano.Mena
11/20/2024, 10:21 AMS.
11/20/2024, 10:24 AMAlejandro Serrano.Mena
11/20/2024, 10:24 AMS.
11/20/2024, 10:26 AMS.
11/20/2024, 11:20 AMcbor {
serializersModule = SerializersModule {
contextual(Either::class) { (a, b) -> EitherSerializer(a, b) }
contextual(Ior::class) { (a, b) -> IorSerializer(a, b) }
contextual(NonEmptyList::class) { (t) -> NonEmptyListSerializer(t) }
contextual(NonEmptySet::class) { (t) -> NonEmptySetSerializer(t) }
// contextual(Option::class) { (t) -> OptionSerializer<*>(t) }
}
}
...
@file:UseSerializers(
NonEmptyListSerializer::class,
EitherSerializer::class,
OptionSerializer::class,
UuidSerializer::class
)
I couldn't find the Arrow module from this PR though https://github.com/arrow-kt/arrow/pull/3413Alejandro Serrano.Mena
11/20/2024, 11:21 AMS.
11/20/2024, 11:21 AMAlejandro Serrano.Mena
11/20/2024, 11:22 AMEither
and Ior
, (I see you wrote OptionSerializer<*>
there)S.
11/20/2024, 11:23 AMArgument type mismatch: actual type is 'kotlinx. serialization. KSerializer<CapturedType(*)>', but 'kotlinx. serialization. KSerializer<T>' was expected.
for the t
parameter in
contextual(Option::class) { (t) -> OptionSerializer(t) }
Alejandro Serrano.Mena
11/20/2024, 11:26 AMS.
11/20/2024, 11:36 AMpublic override fun <T : Any> contextual(
kClass: KClass<T>,
provider: (typeArgumentsSerializers: List<KSerializer<*>>) -> KSerializer<*>
): Unit = registerSerializer(kClass, ContextualProvider.WithTypeArguments(provider))