Fixed some tsc errors
This commit is contained in:
parent
7842f7e35f
commit
6cb23eb82e
|
@ -35,8 +35,6 @@ export const getBySlugEndpoint = createGetByEndpoint(
|
|||
return [];
|
||||
}
|
||||
switch (relationTo) {
|
||||
case "contents":
|
||||
return [{ relationTo, value }];
|
||||
case "library-items":
|
||||
return [{ relationTo, value }];
|
||||
case "pages":
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import payload, { GeneratedTypes } from "payload";
|
||||
import { Collections } from "../constants";
|
||||
import { CollectionEndpoint } from "../types/payload";
|
||||
|
||||
export const createGetByEndpoint = <C extends Collections, R>(
|
||||
export const createGetByEndpoint = <C extends keyof GeneratedTypes["collections"], R>(
|
||||
collection: C,
|
||||
attribute: string,
|
||||
handler: (doc: GeneratedTypes["collections"][C]) => Promise<R> | R
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import payload, { GeneratedTypes } from "payload";
|
||||
import { BasePayload } from "payload/dist/payload";
|
||||
import QueryString from "qs";
|
||||
import { Collections } from "../constants";
|
||||
import { Recorder } from "../types/collections";
|
||||
import { CollectionEndpoint } from "../types/payload";
|
||||
import { isDefined } from "../utils/asserts";
|
||||
|
@ -39,7 +38,7 @@ type Params<S> = {
|
|||
};
|
||||
payload: {
|
||||
path?: string;
|
||||
collection: Collections;
|
||||
collection: keyof GeneratedTypes["collections"];
|
||||
import?: (strapiObject: S, user: any) => Promise<void>;
|
||||
convert?: (
|
||||
strapiObject: S,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { BeforeDuplicate } from "payload/types";
|
||||
|
||||
export const beforeDuplicatePiping = (hooks: BeforeDuplicate[]): BeforeDuplicate => {
|
||||
return ({ data: initialData }) => hooks.reduce((data, hook) => hook({ data }), initialData);
|
||||
return (initialArgs: Parameters<BeforeDuplicate>["0"]) =>
|
||||
hooks.reduce((data, hook) => hook({ ...initialArgs, data }), initialArgs.data);
|
||||
};
|
||||
|
|
|
@ -20,7 +20,7 @@ import {
|
|||
UnderlineTextFeature,
|
||||
UnorderedListFeature,
|
||||
UploadFeature,
|
||||
lexicalEditor
|
||||
lexicalEditor,
|
||||
} from "@payloadcms/richtext-lexical";
|
||||
import { Block, RichTextAdapter } from "payload/types";
|
||||
|
||||
|
@ -53,7 +53,7 @@ export const createEditor = ({
|
|||
if (blocks.length > 0) enabledFeatures.push(BlocksFeature({ blocks }));
|
||||
if (headings) enabledFeatures.push(ParagraphFeature(), HeadingFeature({}));
|
||||
if (debugs) enabledFeatures.push(TreeViewFeature());
|
||||
if (images) enabledFeatures.push(UploadFeature({ collections: [] }));
|
||||
if (images) enabledFeatures.push(UploadFeature());
|
||||
if (links) enabledFeatures.push(LinkFeature({}));
|
||||
if (relations) enabledFeatures.push(RelationshipFeature());
|
||||
if (alignment) enabledFeatures.push(AlignFeature());
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import payload from "payload";
|
||||
import payload, { GeneratedTypes } from "payload";
|
||||
import { Collections, KeysTypes } from "../constants";
|
||||
import { StrapiImage } from "../types/strapi";
|
||||
import { isDefined } from "./asserts";
|
||||
|
@ -35,7 +35,7 @@ export const findRecorder = async (name: string): Promise<string> => {
|
|||
|
||||
type UploadStrapiImage = {
|
||||
image: StrapiImage;
|
||||
collection: Collections;
|
||||
collection: keyof GeneratedTypes["collections"];
|
||||
};
|
||||
|
||||
export const uploadStrapiImage = async ({
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import tags from "language-tags";
|
||||
import { RichTextContent } from "../constants";
|
||||
import { isUndefined } from "./asserts";
|
||||
|
||||
export const shortenEllipsis = (text: string, length: number): string =>
|
||||
|
@ -24,9 +25,7 @@ export const formatToPascalCase = (name: string): string => capitalize(formatToC
|
|||
|
||||
export const plainTextToLexical = (
|
||||
text: string
|
||||
): {
|
||||
[k: string]: unknown;
|
||||
}[] => ({
|
||||
): RichTextContent => ({
|
||||
root: {
|
||||
type: "root",
|
||||
format: "",
|
||||
|
|
Loading…
Reference in New Issue