compose-destinations icon indicating copy to clipboard operation
compose-destinations copied to clipboard

Kotlin 2.2.0 seems to break NavArgs that use TypeAlias

Open cwsiteplan opened this issue 5 months ago • 4 comments

using latest library version (2.2.0)

Having NavArgs:

typealias ProjectLayerId = String?

data class CreateMarkerNavArgs(
    val projectId: String,
    val preselectedLayerId: ProjectLayerId,
)

since i upgraded to kotlin 2.2.0 and ksp to 2.2.0-2.0.2 it breaks the build bc. generated destination does not pick up the nullability from the typealias

public operator fun invoke(
		projectId: String,
		preselectedLayerId: String, <-- should be nullable
    ): Direction {

it works fine when using kotlin 2.1.20 and corresponding ksp (2.1.20-1.0.31) probably a bug/change in KSP?

ofc the nullability inside the typealias maybe not ideal and should probably be a nullable value class instead - still wanted to report that.

cwsiteplan avatar Jul 09 '25 10:07 cwsiteplan

I have the same issue and applying kotlin 2.1.20 and corresponding ksp (2.1.20-1.0.31) doesn't help

ViacheslavRollo avatar Sep 09 '25 17:09 ViacheslavRollo

Maybe my issue is a bit different:

using latest library version (2.2.0)

Nullable fields in NavAgs that have 'null' value returns a value in the next format string [fieldName] instead of null

I'll raise a separate ticket

ViacheslavRollo avatar Sep 09 '25 17:09 ViacheslavRollo

any chance we can resolve that problem? still happening for me with 2.3.0 and kotlin 2.2.21

cwsiteplan avatar Dec 11 '25 16:12 cwsiteplan

actually, i decided to remove the nullable annotation inside the typealias and make it explicit on call-site - seems anyways the better convention - so not an issue for me anymore

cwsiteplan avatar Dec 11 '25 16:12 cwsiteplan