Skip to content

TS Error: Graphql types generated by codegen use incorrect import for admin api types #2873

@kyleruscigno

Description

@kyleruscigno

Issue summary

GraphQL Types generated by Shopify's codegen preset @shopify/api-codegen-preset in admin.generated.d.ts have an incorrect import for the admin types from @shopify/admin-api-client

Before opening this issue, I have:

  • Upgraded to the latest version of the relevant packages
  • Set { logger: { level: LogSeverity.Debug } } in my configuration, when applicable
  • Found a reliable way to reproduce the problem that indicates it's a problem with the package
  • Tested a project from scratch with the typescript, the @shopify/admin-api-client and @shopify/api-codegen-preset
  • Looked for similar issues in this repository
  • A similar issue was reported here last year
  • Checked that this isn't an issue with a Shopify API

Using the @shopify/admin-api-client with Shopify's codegen @shopify/api-codegen-preset. The GraphQL types generated by codegen in admin.generated.d.ts have this typescript error.

Image

The path to ./admin.types is invalid because the default output for the admin types is admin.types.d.ts. This prevents you from building the typescript project

Image

The .graphqlrc.ts is configured following the basic template outlined here:

import {ApiType, shopifyApiProject} from '@shopify/api-codegen-preset';

export default {
  schema: 'https://shopify.dev/admin-graphql-direct-proxy/2025-10',
  documents: ['./src/*.ts', '!node_modules'],
  projects: {
    default: shopifyApiProject({
      apiType: ApiType.Admin,
      apiVersion: '2025-10',
      outputDir: './src/types',
    }),
  },
};

I can change it manually to ./admin.types.js but this would have to be done every time codegen compiles the types

Expected behavior

Generated files from Shopify api packages should be compatible with each other out of the box

Actual behavior

There is a typescript error in the import

Steps to reproduce the problem

  1. Template a new typescript project with the @shopify/shopify-api @shopify/admin-api-client and @shopify/api-codegen-preset packages
  2. Create a .graphqlrc.ts configuration
  3. Create a graphql query in the project that will be compiled by codegen
  4. Run graphql-codegen
  5. Open the admin.generated.d.ts file to verify the error or run "tsc" to compile typescript and verify the error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions