I'd like to find a syntax that would make the following code work:
interface ValueAccessor<TValue> {
returnValue(): TValue;
}
class Caller<TAccessor extends ValueAccessor> {
public callAccessor<TValue>(accessor: TAccessor<TValue>): TValue {
return accessor.returnValue();
}
}
I'd like to keep the TAccessor type "generic" so that we can call the callAccessor method with any concrete implementation of ValueAccessor, whathever the type of the TValue.
Currently, I get the following compilation error on the Caller class definition:
Generic type 'ValueAccessor<TValue>' requires 1 type argument(s).ts(2314)