scalaplayframeworktwirltype-variables

Type variable in Twirl page constructor


I want to do something like this:

 @import TypedCaseClass
 @(typedCaseClass: TypedCaseClass[T])(implicit request: RequestHeader, 
  messages: Messages){
   //...
 }

Not possible?


Solution

  • Just use a wildcard?

    @import TypedCaseClass
    @(typedCaseClass: TypedCaseClass[_])(implicit request: RequestHeader, 
      messages: Messages){
      //...
    }
    

    If you actually want to define a type parameter T for the template, then no, that's not possible. You could raise a feature request here.