-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
export all interfaces instead of just the 'top' interface #15
Comments
Hello @hemmoleg! I believe that the DTOs for request responses should already be available for use. (Potentially redefining Code example: import Galeforce from 'galeforce';
const galeforce = new Galeforce({
'riot-api': {
key: 'RGAPI-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
},
});
type Info = Galeforce.dto.MatchDTO['info'];
(async () => {
const matchInfo: Info = (await galeforce.lol.match.match()
.region(galeforce.region.riot.AMERICAS)
.matchId('NA1_1234567890')
.exec()).info;
console.log(matchInfo);
})(); Please let me know if this works for you! |
Hello bcho04, thank you very much for your answer. that does indeed work for me. However it still seems like kind of a hack, so just out of curiosity: why dont you just export the other interfaces as well? |
There are a couple reasons why I'm currently not exporting all of the lower-level interfaces for the DTOs; there's some name collision with the actual interface names, they're accessible as properties of the top-level interfaces corresponding to the API return values, and the sheer number of them (and their internal nature) makes it somewhat messy to export all of them directly. |
oh ok. well thank you for the explanation :) |
Hey,
could you change all the .d.ts files to export all interfaces? There are two reasons why I think this would be a good change:
foo(match.info : any)
tofoo(match.info : Info)
This has two advantages: first type safety and second enabling auto complete for the properties of Info in the method. I know you could also just always pass the entire match to any function. however i think thats kind of unnecessary.let matchInfo: any;
you could writematchInfo : Info;
This comes with the same adantages as the first reason.The text was updated successfully, but these errors were encountered: