chore: fix tsc errors
This commit is contained in:
@@ -44,7 +44,7 @@ export const CustomViews2: CollectionConfig = {
|
||||
MyCustomViewWithNestedPath: {
|
||||
Component: CustomNestedTabView,
|
||||
path: customNestedTabViewPath,
|
||||
tab: {
|
||||
Tab: {
|
||||
label: 'Custom Nested Tab View',
|
||||
href: customNestedTabViewPath,
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { DocumentTabComponent } from 'payload/types'
|
||||
|
||||
import React from 'react'
|
||||
|
||||
import { CustomTabComponentClient } from './client'
|
||||
import { CustomTabComponentClient } from './client.js'
|
||||
import './index.scss'
|
||||
|
||||
export const CustomTabComponent: DocumentTabComponent = (props) => {
|
||||
|
||||
@@ -11,7 +11,7 @@ export const FieldDescriptionComponent: DescriptionComponent = () => {
|
||||
|
||||
return (
|
||||
<div className={`field-description-${path}`}>
|
||||
Component description: {path} - {value}
|
||||
Component description: {path} - {value as string}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { EditViewComponent } from 'payload/types'
|
||||
|
||||
import { SetStepNav } from '@payloadcms/ui/elements/StepNav'
|
||||
import { notFound } from 'next/navigation.js'
|
||||
import React, { Fragment } from 'react'
|
||||
|
||||
import type { ServerSideEditViewProps } from '../../../../../packages/payload/types.js'
|
||||
|
||||
import { customTabLabelViewTitle } from '../../../shared.js'
|
||||
|
||||
export const CustomTabLabelView: React.FC<ServerSideEditViewProps> = ({ initPageResult }) => {
|
||||
export const CustomTabLabelView: EditViewComponent = ({ initPageResult }) => {
|
||||
if (!initPageResult) {
|
||||
notFound()
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { EditViewComponent } from 'payload/types'
|
||||
|
||||
import { SetStepNav } from '@payloadcms/ui/elements/StepNav'
|
||||
import { notFound } from 'next/navigation.js'
|
||||
import React, { Fragment } from 'react'
|
||||
|
||||
import type { ServerSideEditViewProps } from '../../../../../packages/payload/types.js'
|
||||
|
||||
import { customNestedTabViewTitle } from '../../../shared.js'
|
||||
|
||||
export const CustomNestedTabView: React.FC<ServerSideEditViewProps> = ({ initPageResult }) => {
|
||||
export const CustomNestedTabView: EditViewComponent = ({ initPageResult }) => {
|
||||
if (!initPageResult) {
|
||||
notFound()
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { AdminViewProps } from 'payload/types.js'
|
||||
import type { AdminViewProps } from 'payload/types'
|
||||
|
||||
import React from 'react'
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { EditViewComponent } from 'payload/types'
|
||||
|
||||
import { SetStepNav } from '@payloadcms/ui/elements/StepNav'
|
||||
import { notFound, redirect } from 'next/navigation.js'
|
||||
import React, { Fragment } from 'react'
|
||||
|
||||
import type { EditViewComponent } from '../../../../../packages/payload/types.js'
|
||||
|
||||
export const CustomVersionsView: EditViewComponent = ({ initPageResult }) => {
|
||||
if (!initPageResult) {
|
||||
notFound()
|
||||
|
||||
@@ -6,7 +6,7 @@ import { sql } from 'drizzle-orm'
|
||||
import { isMongoose } from './isMongoose.js'
|
||||
|
||||
export async function resetDB(_payload: Payload, collectionSlugs: string[]) {
|
||||
if (isMongoose(_payload)) {
|
||||
if (isMongoose(_payload) && 'collections' in _payload.db && collectionSlugs.length > 0) {
|
||||
await _payload.db.collections[collectionSlugs[0]].db.dropDatabase()
|
||||
} else {
|
||||
const db: PostgresAdapter = _payload.db as unknown as PostgresAdapter
|
||||
|
||||
@@ -93,7 +93,7 @@ export async function createSnapshot(
|
||||
snapshotKey: string,
|
||||
collectionSlugs: string[],
|
||||
) {
|
||||
if (isMongoose(_payload)) {
|
||||
if (isMongoose(_payload) && 'collections' in _payload.db) {
|
||||
const mongooseCollections = _payload.db.collections[collectionSlugs[0]].db.collections
|
||||
|
||||
await createMongooseSnapshot(mongooseCollections, snapshotKey)
|
||||
@@ -112,7 +112,7 @@ export async function restoreFromSnapshot(
|
||||
snapshotKey: string,
|
||||
collectionSlugs: string[],
|
||||
) {
|
||||
if (isMongoose(_payload)) {
|
||||
if (isMongoose(_payload) && 'collections' in _payload.db) {
|
||||
const mongooseCollections = _payload.db.collections[collectionSlugs[0]].db.collections
|
||||
await restoreFromMongooseSnapshot(mongooseCollections, snapshotKey)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user