I have the next structure
type child = {
id:string;
// other props
};
type parent = {
children: ReactElement<child>[];
onSelect:(val: /* literals of children ids ("id1" | "id2"...) */) =>void;
}
So as I imagine it, it would be good to have "this" type to allow to refer to the field of itself. So if I pass children with id1 and id2 as props to parent component, it could get its literal types and type of "onSelect" argument would be not just string, but literal types of ids of children
I found ThisParameterType and ThisType in typescript utilities, but those "this" are not type's this. Right? Is there a way to do it in ts?