Skip to content

Commit 08251ec

Browse files
authored
fix: return type of findByID with strict: true (#8953)
### What? Corrects the return type of `findByID` when `strict: true` / `strictNullChecks: true` is used, adds `null` to the return type _only_ when `disableErrors: true` is passed. ![image](https://github.com/user-attachments/assets/fb59312c-6a79-457c-8d27-d2a91473bcb3) ![image](https://github.com/user-attachments/assets/2116acbf-730c-4ae6-b662-f83a40c5d9f2)
1 parent d192f14 commit 08251ec

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/payload/src/types/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ export type SelectMode = 'exclude' | 'include'
163163

164164
export type SelectType = SelectExcludeType | SelectIncludeType
165165

166-
export type ApplyDisableErrors<T, DisableErrors extends boolean> = DisableErrors extends true
167-
? null | T
168-
: T
166+
export type ApplyDisableErrors<T, DisableErrors = false> = false extends DisableErrors
167+
? T
168+
: null | T
169169

170170
export type TransformDataWithSelect<
171171
Data extends Record<string, any>,

0 commit comments

Comments
 (0)