Fixed typescript name
This commit is contained in:
parent
5ebe7a12eb
commit
509cbdba9b
|
@ -694,22 +694,22 @@ declare module 'payload' {
|
|||
collections: {
|
||||
'library-items': LibraryItem
|
||||
'contents': Content
|
||||
'contents-folders': Contents Folder
|
||||
'contents-folders': ContentsFolder
|
||||
'posts': Post
|
||||
'chronology-items': ChronologyItem
|
||||
'chronology-eras': Chronology Era
|
||||
'chronology-eras': ChronologyEra
|
||||
'weapons': Weapon
|
||||
'weapons-groups': Weapons Group
|
||||
'weapons-thumbnails': Weapons Thumbnail
|
||||
'contents-thumbnails': Contents Thumbnail
|
||||
'library-items-thumbnails': Library Item Thumbnail
|
||||
'library-items-scans': Library Item Scans
|
||||
'library-items-gallery': Library Item Gallery
|
||||
'recorders-thumbnails': Recorders Thumbnail
|
||||
'posts-thumbnails': Post Thumbnail
|
||||
'weapons-groups': WeaponsGroup
|
||||
'weapons-thumbnails': WeaponsThumbnail
|
||||
'contents-thumbnails': ContentsThumbnail
|
||||
'library-items-thumbnails': LibraryItemThumbnail
|
||||
'library-items-scans': LibraryItemScans
|
||||
'library-items-gallery': LibraryItemGallery
|
||||
'recorders-thumbnails': RecordersThumbnail
|
||||
'posts-thumbnails': PostThumbnail
|
||||
'files': File
|
||||
'videos': Video
|
||||
'videos-channels': Videos Channel
|
||||
'videos-channels': VideosChannel
|
||||
'languages': Language
|
||||
'currencies': Currency
|
||||
'recorders': Recorder
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { CollectionConfig } from "payload/types";
|
||||
import { Collections } from "../constants";
|
||||
import { formatToPascalCase } from "./string";
|
||||
|
||||
type CollectionConfigWithPlugins = CollectionConfig;
|
||||
|
||||
|
@ -13,5 +14,5 @@ export type BuildCollectionConfig = Omit<
|
|||
|
||||
export const buildCollectionConfig = (config: BuildCollectionConfig): CollectionConfig => ({
|
||||
...config,
|
||||
typescript: { interface: config.labels.singular },
|
||||
typescript: { interface: formatToPascalCase(config.labels.singular) },
|
||||
});
|
||||
|
|
|
@ -19,3 +19,5 @@ export const formatToCamelCase = (name: string): string =>
|
|||
.split(/[ \_-]/g)
|
||||
.map((part, index) => (index > 0 ? capitalize(part) : part))
|
||||
.join("");
|
||||
|
||||
export const formatToPascalCase = (name: string): string => capitalize(formatToCamelCase(name));
|
||||
|
|
Loading…
Reference in New Issue