shopify-api-js icon indicating copy to clipboard operation
shopify-api-js copied to clipboard

Can't import `enum` from generated GraphQL type definition files

Open vincaslt opened this issue 1 year ago • 7 comments

The GraphQL type definitions are generated into admin.types.d.ts file as per: https://github.com/Shopify/shopify-api-js/blob/3e55838fe4f192d5d639670834f2a002800ba271/packages/api-codegen-preset/src/helpers/api-configs.ts#L24

The problem I'm facing is that I can't import enum from the generated file - .d.ts files are discarded during compilation.

So this import won't work:

import { ImageContentType } from "~/types/admin.types";

[ERROR] Could not resolve "~/types/admin.types": image

Am I maybe wrong to try to import stuff from those files and they should be used somehow differently?

vincaslt avatar Jan 11 '24 12:01 vincaslt