Skip to content

Commit 5d5c6cc

Browse files
authored
Merge pull request #203 from cipherstash/drizzle-typing
refactor: 🏷️ add explicit return type to extractProtectSchema
2 parents 7f98efb + ebda487 commit 5d5c6cc

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

.changeset/polite-dryers-shop.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cipherstash/drizzle": minor
3+
---
4+
5+
Added explicit return type to extractProtectSchem.

packages/drizzle/src/pg/schema-extraction.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import {
2-
type ProtectColumn,
3-
type ProtectTable,
4-
csColumn,
5-
csTable,
6-
} from '@cipherstash/protect'
1+
import { type ProtectColumn, csColumn, csTable } from '@cipherstash/protect'
72
import type { PgTable } from 'drizzle-orm/pg-core'
83
import { getEncryptedColumnConfig } from './index.js'
94

@@ -28,7 +23,9 @@ import { getEncryptedColumnConfig } from './index.js'
2823
*/
2924
// We use any for the PgTable generic because we need to access Drizzle's internal properties
3025
// biome-ignore lint/suspicious/noExplicitAny: Drizzle table types don't expose Symbol properties
31-
export function extractProtectSchema<T extends PgTable<any>>(table: T) {
26+
export function extractProtectSchema<T extends PgTable<any>>(
27+
table: T,
28+
): ReturnType<typeof csTable<Record<string, ProtectColumn>>> {
3229
// Drizzle tables store the name in a Symbol property
3330
// biome-ignore lint/suspicious/noExplicitAny: Drizzle tables don't expose Symbol properties in types
3431
const tableName = (table as any)[Symbol.for('drizzle:Name')] as

0 commit comments

Comments
 (0)