Let's say I have two functions like this (I currently have like 20 different that looks pretty much the same. Only difference is the route and the DTOs) I don't want to send both route and DTO in the function call as that would make the function calls more messy/complicated. So I'd rather only call it with either Asset | Personnel | Something else that is valid
 async getAllAssets() {
    return await this.get<AssetDto[]>('assets/assets')
  }
 async getAllPersonnels() {
    return await this.get<PersonnelDto[]>('personnel/personnels')
  }
And I want to make it more generic so I only need one function instead of two. How do I implement that? My own try is below. Maybe it will make it more clear what I actually want as well. I'm a total newbie with TypeScript and only been at it for one week. My "dream" implementation would also include enum so I could call the function with e.g. Entity.Asset or Entity.Personnel and then under the hood it then knows that it should use the the route and dto for either Asset or Personnel.
export type Asset = {
    route: '/assets/asset',
    dto: AssetDto[]
}
export type Personnel = {
    route: '/personnel/personnel',
    dto: PersonnelDto[]
}
export type Entity = Asset | Personnel
And here is the example of a more generic function:
 async getAll<T extends Entity>(entity: T) {
    return await this.get<typeof entity.Dto>(entity.route)
  }
But I don't know how to actually call the function with a type? Or is it even possible to do it like this?
  async howIWantAFunctionCallToBeLike() {
    await this.getAll(Entity.Asset))
  }

