You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Typescript type collision is possible with the generated types, in combination with imported schema types. This is because the generated types for a query are based on the key path inside the query, and those key paths could match GQL schema types.
And then we have a recursive type reference to the containing type, instead of the imported schema type.
If we rename the field to something sensible for consuming code like marketManager, we force a type renaming to MarketMarketManager, which is an okay work around.
Overview
Typescript type collision is possible with the generated types, in combination with imported schema types. This is because the generated types for a query are based on the key path inside the query, and those key paths could match GQL schema types.
example:
The
type
on amarket.manager
is an enum calledMarketManager
.The generated query type definitions then becomes:
And then we have a recursive type reference to the containing type, instead of the imported schema type.
If we rename the field to something sensible for consuming code like
marketManager
, we force a type renaming toMarketMarketManager
, which is an okay work around.But note, if we define this market query part as a fragment, the types for the fragment are generated slightly different, so we get:
initially, there's no collision because the names don't have the
Market
prefix:after the rename we get a collision:
I'm not consuming the fragment types directly, so this is not an issue.
A fix?
Maybe we could detect this and rename the imported schema types as they are imported.
Consuming repo
The text was updated successfully, but these errors were encountered: