chore: type fixes

This commit is contained in:
James
2024-02-15 14:12:59 -05:00
parent ef82489040
commit abf0f7111d
8 changed files with 9 additions and 19 deletions

View File

@@ -1,5 +1,6 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY it because it could be re-written at any time. */
import config from 'payload-config'
import { GRAPHQL_PLAYGROUND_GET } from '@payloadcms/next/routes'
export const GET = GRAPHQL_PLAYGROUND_GET
export const GET = GRAPHQL_PLAYGROUND_GET(config)

View File

@@ -3,6 +3,4 @@
import { RootPage } from '@payloadcms/next/pages/Root'
import config from 'payload-config'
import './test.scss'
export default () => RootPage({ config })

View File

@@ -76,7 +76,7 @@ declare module 'payload' {
connection: Connection
globals: GlobalModel
mongoMemoryServer: any
sessions: Record<number | string, ClientSession>
// sessions: Record<number | string, ClientSession>
versions: {
[slug: string]: CollectionModel
}

View File

@@ -48,7 +48,7 @@ export const init: Init = async function init(this: MongooseAdapter) {
versionModelName,
versionSchema,
this.autoPluralization === true ? undefined : versionModelName,
) as CollectionModel
) as unknown as CollectionModel
// this.payload.versions[collection.slug] = model;
this.versions[collection.slug] = model
}
@@ -57,11 +57,9 @@ export const init: Init = async function init(this: MongooseAdapter) {
collection.slug,
schema,
this.autoPluralization === true ? undefined : collection.slug,
) as CollectionModel
) as unknown as CollectionModel
this.collections[collection.slug] = model
// TS expect error only needed until we launch 2.0.0
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
this.payload.collections[collection.slug] = {
config: collection,
}
@@ -94,7 +92,7 @@ export const init: Init = async function init(this: MongooseAdapter) {
versionModelName,
versionSchema,
versionModelName,
) as CollectionModel
) as unknown as CollectionModel
this.versions[global.slug] = versionsModel
}
})

View File

@@ -27,16 +27,10 @@ import type {
import type { BuildQueryArgs } from './queries/buildQuery'
export interface CollectionModel extends Model<any>, PaginateModel<any>, PassportLocalModel {
export interface CollectionModel extends Model<any>, PaginateModel<any> {
/** buildQuery is used to transform payload's where operator into what can be used by mongoose (e.g. id => _id) */
buildQuery: (args: BuildQueryArgs) => Promise<Record<string, unknown>> // TODO: Delete this
}
type Register<T = any> = (doc: T, password: string) => T
interface PassportLocalModel {
authenticate: any
register: Register
}
export interface AuthCollectionModel extends CollectionModel {
resetPasswordExpiration: Date

View File

@@ -82,7 +82,7 @@ async function runMigrationFile(payload: Payload, migration: Migration, batch: n
payload.logger.info({ msg: `Migrating: ${migration.name}` })
const pgAdapter = payload.db
const pgAdapter = payload.db as PostgresAdapter
const drizzleJSON = generateDrizzleJson(pgAdapter.schema)
try {

View File

@@ -3,7 +3,6 @@ import type { TypeWithID } from 'payload/types'
import { eq } from 'drizzle-orm'
import { ValidationError } from 'payload/errors'
import { i18nInit } from 'payload/utilities'
import type { BlockRowToInsert } from '../transform/write/types'
import type { Args } from './types'

View File

@@ -107,5 +107,5 @@
"path": "./packages/ui"
}
],
"include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"]
"include": ["next-env.d.ts", ".next/types/**/*.ts", "app/**/*.ts", "app/**/*.tsx"]
}