fix: database adapter types
This commit is contained in:
@@ -4,7 +4,7 @@ import React from 'react'
|
||||
|
||||
import type { AdapterArguments } from '../types'
|
||||
|
||||
const RichTextCell: React.FC<CellComponentProps<RichTextField<AdapterArguments>, any>> = ({
|
||||
const RichTextCell: React.FC<CellComponentProps<RichTextField<any[], AdapterArguments>, any>> = ({
|
||||
data,
|
||||
}) => {
|
||||
const flattenedText = data?.map((i) => i?.children?.map((c) => c.text)).join(' ')
|
||||
|
||||
@@ -7,7 +7,7 @@ type Arguments = {
|
||||
currentDepth?: number
|
||||
data: unknown
|
||||
depth: number
|
||||
field: RichTextField<AdapterArguments>
|
||||
field: RichTextField<any[], AdapterArguments>
|
||||
key: number | string
|
||||
overrideAccess?: boolean
|
||||
req: PayloadRequest
|
||||
|
||||
@@ -5,13 +5,13 @@ import type { AdapterArguments } from '../types'
|
||||
import { populate } from './populate'
|
||||
import { recurseNestedFields } from './recurseNestedFields'
|
||||
|
||||
export type Args = Parameters<RichTextAdapter<AdapterArguments>['afterReadPromise']>[0]
|
||||
export type Args = Parameters<RichTextAdapter<any[], AdapterArguments>['afterReadPromise']>[0]
|
||||
|
||||
type RecurseRichTextArgs = {
|
||||
children: unknown[]
|
||||
currentDepth: number
|
||||
depth: number
|
||||
field: RichTextField<AdapterArguments>
|
||||
field: RichTextField<any[], AdapterArguments>
|
||||
overrideAccess: boolean
|
||||
promises: Promise<void>[]
|
||||
req: PayloadRequest
|
||||
|
||||
@@ -7,8 +7,8 @@ import { defaultRichTextValue } from './defaultValue'
|
||||
export const richTextValidate: Validate<
|
||||
unknown,
|
||||
unknown,
|
||||
RichTextField<AdapterArguments>,
|
||||
RichTextField<AdapterArguments>
|
||||
RichTextField<any[], AdapterArguments>,
|
||||
RichTextField<any[], AdapterArguments>
|
||||
> = (value, { required, t }) => {
|
||||
if (required) {
|
||||
const stringifiedDefaultValue = JSON.stringify(defaultRichTextValue)
|
||||
|
||||
@@ -9,7 +9,7 @@ import { richTextRelationshipPromise } from './data/richTextRelationshipPromise'
|
||||
import { richTextValidate } from './data/validation'
|
||||
import RichTextField from './field'
|
||||
|
||||
export function slateEditor(args: AdapterArguments): RichTextAdapter<AdapterArguments> {
|
||||
export function slateEditor(args: AdapterArguments): RichTextAdapter<any[], AdapterArguments> {
|
||||
return {
|
||||
CellComponent: withMergedProps({
|
||||
Component: RichTextCell,
|
||||
|
||||
@@ -73,4 +73,4 @@ export type AdapterArguments = {
|
||||
}
|
||||
}
|
||||
|
||||
export type FieldProps = RichTextFieldProps<AdapterArguments>
|
||||
export type FieldProps = RichTextFieldProps<any, AdapterArguments>
|
||||
|
||||
Reference in New Issue
Block a user