Skip to content

fix(plugin-seo): type Meta.image and extract shared MetaImageValue#17073

Open
Notorious-Ali wants to merge 1 commit into
payloadcms:mainfrom
Notorious-Ali:main
Open

fix(plugin-seo): type Meta.image and extract shared MetaImageValue#17073
Notorious-Ali wants to merge 1 commit into
payloadcms:mainfrom
Notorious-Ali:main

Conversation

@Notorious-Ali

Copy link
Copy Markdown

What?

Replaces the untyped image?: any on the plugin's Meta type with a precise type, and extracts a shared MetaImageValue type so that Meta.image and GenerateImage 's return value can no longer drift apart.

Why?

Meta.image was typed any

How?

In packages/plugin-seo/src/types.ts:

  • Added a new exported type:
    export type MetaImageValue = { id: number | string } | number | string
  • Meta.image is now image?: MetaImageValue instead of any.
  • GenerateImage's return type now reuses MetaImageValue | Promise<MetaImageValue> — structurally identical to the previous inline union, so there is no runtime/behavior change.

In packages/plugin-seo/src/exports/types.ts:

  • Re-exported MetaImageValue from the public types barrel so consumers can type image values consistently.

Before:

export type Meta = {
  description?: string
  image?: any // TODO: type this
  keywords?: string
  title?: string
}

After:

export type MetaImageValue = { id: number | string } | number | string

export type Meta = {
  description?: string
  image?: MetaImageValue
  keywords?: string
  title?: string
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant