graphitation icon indicating copy to clipboard operation
graphitation copied to clipboard

[supermassive] Wrong Location type is used on DocumentWithMinimalViableSchema

Open alina-zaieva opened this issue 10 months ago • 1 comments

DocumentWithMinimalViableSchema type in its definition reuses types from GraphQL.js for definitions property, but for some reason this is not the case for loc property:

  1. DocumentWithMinimalViableSchema#loc uses built-in Location type (i.e., the type of window.location).
  2. DocumentNode#loc uses their own Location type (https://github.com/graphql/graphql-js/blob/5adeb7f7721e299d6f747bf9c985387164b79fff/src/language/ast.ts#L9).

The two are not compatible and so it is not possible to pass DocumentWithMinimalViableSchema where DocumentNode is expected. This does not seem intentional to me since a document has nothing to do with in-browser location 🙂

alina-zaieva avatar Apr 09 '25 13:04 alina-zaieva

@alina-zaieva Good catch! We will happily accept a PR fixing this oversight.

vladar avatar May 22 '25 13:05 vladar