VSCode message: Type mismatch: cannot convert from Item to GenericItem

I get the following ‘problems’ in vscode and I wonder how to fix the warning messages (code runs ok).

val findSetpoint= [ GenericItem s |
    val parts = s.name.split("_")
    val setpoint_name = String.format("%s_%s_SetPoint", parts.get(0),  parts.get(1))
    Evo_SetPoint.members.findFirst[name.equals(setpoint_name)] as NumberItem    
]

rule "SomeRule"
when
    ....
then
   ....
   var setpoint = findSetpoint.apply(setpoint_status) 
   ....
end

I tried to do the following, but Item is not a type. Do I need to import something?
I can, of course, cast to a GenericItem, but that feels like a workaround.

     val findSetpoint= [ Item s |
         ....
     ]

XY problem. GenericItem is fine so where’s your problem ?

I want to get rid of the problem messages in vscode.

And I am wondering how I can declare it like this (this now gives an error)

     val findSetpoint= [ Item s |
         ....
     ]

Depends on the item type you pass as the argument (setpoint_status). Either cast that to GenericItem when calling or use a specific item type such as Number, String or whatever it is.

Thanks, I was under the false impression that ‘Item’ was also a type (that needed importing from somewhere).

Obviously so. GenericItem already is what you are looking for.