-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
When I try to make the parameter in htmxTemplate nullable I get this compiler error:
None of the following candidates is applicable:
fun <reified CONTROLLER : Any, reified REQ : Record, RESP : Any> route(verb: HttpVerb, path: String, noinline binding: CONTROLLER.(REQ) -> RESP, crossinline renderer: TagConsumer<*>.(RESP) -> Unit): HxRoute:
Argument type mismatch: actual type is 'HtmxTemplate<ChatResponse?>', but 'Function2<TagConsumer<*>, uninferred RESP (of fun <CONTROLLER : Any, REQ : Record, RESP : Any> route), Unit>' was expected.
fun <reified CONTROLLER : Any, reified REQ : Record, RESP : Any> route(verb: HttpVerb, path: String, noinline binding: CONTROLLER.(REQ) -> RESP, renderer: HtmxTemplate<RESP>): HxRoute:
Argument type mismatch: actual type is 'HtmxTemplate<ChatResponse?>', but 'HtmxTemplate<uninferred RESP (of fun <CONTROLLER : Any, REQ : Record, RESP : Any> route)>' was expected.
fun <reified CONTROLLER : Any, reified REQ : Record, USER : Principal, RESP : Any> route(verb: HttpVerb, path: String, noinline binding: CONTROLLER.(USER?, REQ) -> RESP, crossinline renderer: TagConsumer<*>.(RESP) -> Unit): HxRoute:
Argument type mismatch: actual type is 'HtmxTemplate<ChatResponse?>', but 'Function2<TagConsumer<*>, uninferred RESP (of fun <CONTROLLER : Any, REQ : Record, USER : Principal, RESP : Any> route), Unit>' was expected.
fun <reified CONTROLLER : Any, reified REQ : Record, USER : Principal, RESP : Any> route(verb: HttpVerb, path: String, noinline binding: CONTROLLER.(USER?, REQ) -> RESP, renderer: HtmxTemplate<RESP>): HxRoute:
Argument type mismatch: actual type is 'HtmxTemplate<ChatResponse?>', but 'HtmxTemplate<uninferred RESP (of fun <CONTROLLER : Any, REQ : Record, USER : Principal, RESP : Any> route)>' was expected.
This is the binding & htmxTemplate:
interface ChatService {
fun invocations(request: ChatRequest): ChatResponse?
}
val chatResponseTemplate = htmxTemplate<ChatResponse?> {
div(classes = "message assistant-message") {
div(classes = "message-content") {
+(it?.result?.output?.text ?: "Could not get response")
}
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels