fix!: improve collection / global slugs type-safety in various places (#8311)
**BREAKING:**
Improves type-safety of collection / global slugs by using `CollectionSlug` / `UploadCollectionSlug` and `GlobalSlug` types instead of `string` in these places:
Adds `UploadCollectionSlug` and `TypedUploadCollection` utility types
This also changes how we suggest to add an upload collection to a cloud-storage adapter:
Before:
```ts
azureStorage({
collections: {
[Media.slug]: true,
},
})
```
After:
```ts
azureStorage({
collections: {
media: true,
},
})
```
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { CollectionSlug } from 'payload'
|
||||
|
||||
export type Breadcrumb = {
|
||||
doc: string
|
||||
label: string
|
||||
@@ -22,7 +24,7 @@ export type NestedDocsPluginConfig = {
|
||||
/**
|
||||
* The slugs of the collections this plugin should extend. If you need different configs for different collections, this plugin can be added to your config more than once having different collections.
|
||||
*/
|
||||
collections: string[]
|
||||
collections: CollectionSlug[]
|
||||
generateLabel?: GenerateLabel
|
||||
generateURL?: GenerateURL
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user