Skip to content

Commit 8401b21

Browse files
authored
fix: deletedAt in TypeWithID not accepting null from generated types (#13363)
### What? Updated `TypeWithID` so `deletedAt` can accept `null`. ### Why? Generated collection types for trash use: ``` deletedAt?: string | null ``` `TypeWithID` previously only allowed `string | undefined`, so assigning documents with `deletedAt: null` caused TypeScript errors. Aligning the types fixes this mismatch and ensures `TypeWithID` is compatible with the generated types. ### How? Modified the `TypeWithID` definition to: ``` export type TypeWithID = { deletedAt?: string | null docId?: any id: number | string } ``` This makes `deletedAt` effectively `string | null | undefined`, matching generated types and eliminating type errors. Fixes #13341
1 parent 20b4de9 commit 8401b21

File tree

1 file changed

+2
-2
lines changed
  • packages/payload/src/collections/config

1 file changed

+2
-2
lines changed

packages/payload/src/collections/config/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,15 +688,15 @@ export type AuthCollection = {
688688
}
689689

690690
export type TypeWithID = {
691-
deletedAt?: string
691+
deletedAt?: null | string
692692
docId?: any
693693
id: number | string
694694
}
695695

696696
export type TypeWithTimestamps = {
697697
[key: string]: unknown
698698
createdAt: string
699-
deletedAt?: string
699+
deletedAt?: null | string
700700
id: number | string
701701
updatedAt: string
702702
}

0 commit comments

Comments
 (0)