I have a question regarding the code snippet below:
interface BaseProps<TControl> {
onEvent: (control: TControl) => void;
}
class BaseControl<TValue, BaseProps<any>> {
onBlur = () => {
onEvent(this); //subscriber must see the whole TS-class instead of BaseControl<TValue, BaseProps<any>>
}
}
It seems that defining a class like:
class BaseControl<TValue, BaseProps<this>>> {}
or having an infinite structure like:
class BaseControl<TValue, BaseProps<BaseControl<TValue, BaseProps<...etc.>>>> {}
is not viable. Is there a way to achieve a similar concept to a generic pointer, such as using BaseProps<this>
?