Skip to content

Commit

Permalink
chore: fix typescript hallucinations (#4559)
Browse files Browse the repository at this point in the history
* chore: fix typescript halluzinations

* chore: remove another unused ts-expect-error directive
  • Loading branch information
geisterfurz007 committed Mar 10, 2024
1 parent f8c2ccf commit c038acb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
15 changes: 7 additions & 8 deletions packages/payload/src/payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,6 @@ export class BasePayload<TGeneratedTypes extends GeneratedTypes> {
[slug: string]: any // TODO: Type this
} = {}

delete<T extends keyof TGeneratedTypes['collections']>(
options: DeleteOptions<T>,
): Promise<BulkOperationResult<T> | TGeneratedTypes['collections'][T]> {
const { deleteLocal } = localOperations
return deleteLocal<T>(this, options)
}

/**
* @description delete one or more documents
* @param options
Expand All @@ -305,11 +298,17 @@ export class BasePayload<TGeneratedTypes extends GeneratedTypes> {
options: DeleteManyOptions<T>,
): Promise<BulkOperationResult<T>>

delete<T extends keyof TGeneratedTypes['collections']>(
options: DeleteOptions<T>,
): Promise<BulkOperationResult<T> | TGeneratedTypes['collections'][T]> {
const { deleteLocal } = localOperations
return deleteLocal<T>(this, options)
}

/**
* @description Initializes Payload
* @param options
*/
// @ts-expect-error // TODO: TypeScript hallucinating again. fix later
async init(options: InitOptions): Promise<Payload> {
this.logger =
options.logger ?? Logger('payload', options.loggerOptions, options.loggerDestination)
Expand Down
1 change: 0 additions & 1 deletion packages/payload/src/preferences/operations/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ async function deleteOperation(args: PreferenceRequest): Promise<Document> {
where,
})

// @ts-expect-error // TODO: fix later
if (result.docs.length === 1) {
return result.docs[0]
}
Expand Down

0 comments on commit c038acb

Please sign in to comment.