I'm trying to store a dictionary of generic Capabilities inside a resource, something like
pub let storedCapabilities: {String: Capability}
But when I attempt to perform any action on one of those capabilities I got a "cannot infer type parameter: T", e.g.:
self.storedCapabilities[tag]!.check()
I have been trying to specify the capability type using run-time types functions such as:
fun CapabilityType(_ type: Type): Type?
fun ReferenceType(authorized: bool, type: Type): Type
But so far I haven't found the way.
Anybody knows if there's a proper of specifying a generic capability's type?
Cheers!
The Capability method
checkneeds a typeTin it in order to be used, otherwise it doesn't know what type it is checking for. Two options:cap.check<T>()