[QUESTION]: specific GitObject
usage? (ie, Blob
& Tree
)
#747
Labels
hacktoberfest
Issues for participation in Hacktoberfest
Status: Up for grabs
Issues that are ready to be worked on by anyone
Type: Support
Any questions, information, or general needs around the SDK or GitHub APIs
Question
Hi there! I was playing around with some queries in typescript. I was querying some trees/blobs off of the Repository object, and these results are typed like
GitObject
.However, I notice that the types are a bit prohibitive. In
schema.d.ts
, I notice thatRepository
is defined like so:You'll see that,
GitObject
is used here, although I'd like to tell TypeScript that its aBlob
orTree
, both of which are types that can appear here. Instead ofMaybe<GitObject>
, the type definition should be something likeMaybe<GitObject | Tree | Blob | /* ...etc */>
. This lack of additional types is how its a bit prohibitive. I know I could useas
in typescript to work around this, but I don't like to do so.Is there a way to do this currently, with this generated schema? Am I missing something?
Current Usage
I have a work-around, but its slightly verbose:
Describe the need
This is sort of verbose, and it'd be lovely if I didn't have to write all these interfaces out.
For maintainers, if you don't find this relevant or something, feel free to just leave a comment and close this, I'm just trying to help! Thanks for your efforts!
Code of Conduct
The text was updated successfully, but these errors were encountered: