Skip to content

Commit 9c29541

Browse files
authored
fix(plugin-seo): loosen some types to restore compatibility between minor versions (#10670)
#9962 could be considered a breaking change - this PR restores compatibility by allowing unknown collection slugs, while still providing type suggestions.
1 parent d2f63dc commit 9c29541

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packages/plugin-seo/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const seoPlugin =
3232
? [
3333
MetaImageField({
3434
hasGenerateFn: typeof pluginConfig?.generateImage === 'function',
35-
relationTo: pluginConfig.uploadsCollection,
35+
relationTo: pluginConfig.uploadsCollection as string,
3636
}),
3737
]
3838
: []),

packages/plugin-seo/src/types.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type {
66
GlobalConfig,
77
GlobalSlug,
88
PayloadRequest,
9+
UploadCollectionSlug,
910
} from 'payload'
1011

1112
export type FieldsOverride = (args: { defaultFields: Field[] }) => Field[]
@@ -70,7 +71,7 @@ export type SEOPluginConfig = {
7071
/**
7172
* Collections to include the SEO fields in
7273
*/
73-
collections?: CollectionSlug[]
74+
collections?: ({} | CollectionSlug)[]
7475
/**
7576
* Override the default fields inserted by the SEO plugin via a function that receives the default fields and returns the new fields
7677
*
@@ -87,7 +88,7 @@ export type SEOPluginConfig = {
8788
/**
8889
* Globals to include the SEO fields in
8990
*/
90-
globals?: GlobalSlug[]
91+
globals?: ({} | GlobalSlug)[]
9192
interfaceName?: string
9293
/**
9394
* Group fields into tabs, your content will be automatically put into a general tab and the SEO fields into an SEO tab
@@ -98,7 +99,7 @@ export type SEOPluginConfig = {
9899
/**
99100
* The slug of the collection used to handle image uploads
100101
*/
101-
uploadsCollection?: CollectionSlug
102+
uploadsCollection?: {} | UploadCollectionSlug
102103
}
103104

104105
export type Meta = {

0 commit comments

Comments
 (0)