#Generated types for upload fields should not include string type.

2 messages · Page 1 of 1 (latest)

tawny crane
#

After running yarn generate:types , the output for upload fields is heroImage: string | Image;.
The expected output should be heroImage: Image;

Is there something wrong with my configuration?

            {
              name: "heroImage",
              type: "upload",
              relationTo: "images",
              required: true,
            },
const Images: CollectionConfig = {
  slug: "images",
  access: {
    read: () => true,
  },
  admin: {
    useAsTitle: "altText",
    group: "Uploads",
  },
  upload: {
    disableLocalStorage: true,
    mimeTypes: ["image/*"],
  },
  fields: [
    {
      name: "altText",
      type: "text",
    },
  ],
};
#

For context, I'm getting typescript error when using the generated types:

Property 'altText' does not exist on type 'string | Image'.
  Property 'altText' does not exist on type 'string'.