vojtechhabarta / typescript-generator

Generates TypeScript from Java - JSON declarations, REST service client
MIT License
1.14k stars 237 forks source link

Missing nullable Kotlin primitive generic type in inheritance #1031

Open HawkSK opened 11 months ago

HawkSK commented 11 months ago

Primitive nullable Kotlin types are ignored when they are used in a generic type in inheritance.

Given

interface IReference<T> {
    val id: T
}

data class SomeDto(
    override val id: Int?
) : IReference<Int?>

generates syntactically incorrect TypeScript

export interface SomeDtoGenerated extends IReferenceGenerated<number> {
    id: number | null;
}

export interface IReferenceGenerated<T> {
    id: T;
}

whereas it should be SomeDtoGenerated extends IReferenceGenerated<number | nullable>

Plugin version: 3.1.1185


Note: Properties/fields do not have this issue. F.e. the following works as expected:

data class Dummy(val dummyField: IReference<Int?>)
klaus7 commented 7 months ago

same here