Skip to content

Generated selection-sets.ts uses hardcoded Query and Mutation types #1353

@fiadliel

Description

@fiadliel

Description

This is related to #1339 - but another issue I found when I figured out my 100% tsc issues and could run checks again.

${config.schema.kindMap.index.Root.query ? `query?: Record<string, Query<${i._$Scalars}>>` : ``}
and the next line refer to hardcoded Query and Mutation types.

Altering these to
${config.schema.kindMap.index.Root.query.name} and ${config.schema.kindMap.index.Root.mutation.name} generates code without errors.

Reproduction Steps/Repo Link

Use a GQL schema like

schema {
  query: QueryRoot
}

type QueryRoot {
  s: String
}

Run tsc --noEmit.

There will be an error like:

.../modules/selection-sets.ts:23:26 - error TS2304: Cannot find name 'Query'.

23   query?: Record<string, Query<_$Scalars>>;
                            ~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions