I'm trying to make an api wrapper. The api allows you to include related entities.
For example, if you want to fetch a server, you can also fetch its owner.
I want the library to be used like
const server = await api.servers.fetch("id");
server.relations.user // undefined (or null)
const server = await api.servers.fetch("id").includeUser();
server.relations.user; // User
I'm not advanced with typescript, so I'm not sure what's the best way to approach this.
I've gotten something to work, but it only works with one include. If you try to chain them, it will only use the latest one. I also have a @true ivy-ignore which I'm not sure how to remove.
I'm also okay with server.relations.get("user") if that can be typed.