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