Related issues:
#248
Given the following GraphQL schema:
type AssetInfo {
id: String!
data: AssetData
}
union AssetData = Video | Audio | Artwork
type Video {
subType: String
}
type Audio {
identifiers: [String]
}
type Artwork {
tags: [String]
}
And this query against it:
{
id
data {
... on Artwork {
tags
}
... on Audio {
identifiers
}
... on Video {
subType
}
}
gql2ts produces the following response for that query:
interface SelectionOnAssetInfo {
id: string;
data:
| Partial<SpreadOnArtwork> &
Partial<SpreadOnCopy> &
Partial<SpreadOnVideo>
| null;
}
I would expect the corresponding query to produce this interface
interface SelectionOnAssetInfo {
id: string;
data: SpreadOnArtwork | SpreadOnCopy | SpreadOnVideo | null;
}
- The
data field should not be wrapped with Partial
- The interfaces should not be intersected with
&, but unioned via |.
Related issues:
#248
Given the following GraphQL schema:
And this query against it:
{ id data { ... on Artwork { tags } ... on Audio { identifiers } ... on Video { subType } }gql2ts produces the following response for that query:
I would expect the corresponding query to produce this interface
datafield should not be wrapped withPartial&, but unioned via|.