Description
When excluding the Spring Framework package (org.springframework.) and an API method returns ResponseEntity<T>, the generator emits any<T> which is invalid TypeScript syntax.
Minimal Reproduction
Java/Kotlin Controller:
@RestController
class MyController {
@GetMapping("/items/{id}")
fun getItem(@PathVariable id: String): ResponseEntity<ItemResponse> {
return ResponseEntity.ok(ItemResponse(id, "name"))
}
}
data class ItemResponse(val id: String, val name: String)
Generator Configuration (Gradle):
typescriptGenerator {
config {
exclude("org.springframework.") // Blanket exclusion
}
}
Generated TypeScript (buggy):
getItem(id: string): AbortablePromise<any<ItemResponse>>
Problem: any<T> is invalid TypeScript syntax - generics cannot be applied to any.
Expected Behavior
One of:
getItem(id: string): AbortablePromise<ItemResponse> (unwrap the generic)
getItem(id: string): AbortablePromise<any> (drop the type parameter if using any)
Workaround
Exclude specific Spring types instead of the whole package:
exclude(
"org.springframework.util.MimeType",
"org.springframework.http.HttpMethod",
"org.springframework.http.HttpStatus"
)
// DO NOT exclude "org.springframework." - generator needs ResponseEntity
Description
When excluding the Spring Framework package (
org.springframework.) and an API method returnsResponseEntity<T>, the generator emitsany<T>which is invalid TypeScript syntax.Minimal Reproduction
Java/Kotlin Controller:
Generator Configuration (Gradle):
typescriptGenerator { config { exclude("org.springframework.") // Blanket exclusion } }Generated TypeScript (buggy):
Problem:
any<T>is invalid TypeScript syntax - generics cannot be applied toany.Expected Behavior
One of:
getItem(id: string): AbortablePromise<ItemResponse>(unwrap the generic)getItem(id: string): AbortablePromise<any>(drop the type parameter if using any)Workaround
Exclude specific Spring types instead of the whole package:
exclude( "org.springframework.util.MimeType", "org.springframework.http.HttpMethod", "org.springframework.http.HttpStatus" ) // DO NOT exclude "org.springframework." - generator needs ResponseEntity