Skip to content

Commit 98283ca

Browse files
authored
fix(db-postgres): ensure module augmentation for generated schema is picked up correctly in turborepo (#12312)
### What? Turborepo fails to compile due to type error in the generated drizzle schema. ### Why? TypeScript may not include the module augmentation for @payloadcms/db-postgres, especially in monorepo or isolated module builds. This causes type errors during the compilation process of turborepo project. Adding the type-only import guarantees that TypeScript loads the relevant type definitions and augmentations, resolving these errors. ### How? This PR adds a type-only import statement to ensure TypeScript recognizes the module augmentation for @payloadcms/db-postgres in the generated drizzle schema from payload, and there is no runtime effect. Fixes #12311 --> ![image](https://github.com/user-attachments/assets/cdec275c-c062-4eb7-9e6a-c3bc3871dd65)
1 parent e93d0ba commit 98283ca

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/drizzle/src/utilities/createSchemaGenerator.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,11 @@ declare module '${this.packageName}' {
267267
*/
268268
`
269269

270+
const importTypes = `import type {} from '${this.packageName}'`
271+
270272
let code = [
271273
warning,
274+
importTypes,
272275
...importDeclarationsSanitized,
273276
schemaDeclaration,
274277
...enumDeclarations,

0 commit comments

Comments
 (0)