How to express "children" or "parent" relation with typescript?

Let's say I have a country and region tables. A region belongs to a country, so on the regiontable, there's a foreign key country_id to the country table.

The question is if it is possible to have a Country type generated like this:

type Country {
  id: number;
}

type Region {
  id: number;
  country_id: number;
  country: Country; // This one is the difficult/impossible one to get? 
}


The goal is to be able to query a region and join it with the country table as well. Thank you!
Was this page helpful?