Skip to content

Commit 3ea5b32

Browse files
snomiaoclaude
andcommitted
fix: replace 'as any' with proper Db type annotation
Replaced the type assertion 'as any' with a proper 'as Db' type annotation for the MongoDB adapter in lib/auth.ts. This addresses the code review feedback to ensure type safety. Changes: - Import Db type from mongodb package - Use 'as Db' instead of 'as any' for mongoClient.db() call 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 42c7ad8 commit 3ea5b32

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { betterAuth } from "better-auth";
22
import { mongodbAdapter } from "better-auth/adapters/mongodb";
3-
import { MongoClient } from "mongodb";
3+
import { MongoClient, type Db } from "mongodb";
44

55
// Backward compatibility with NextAuth environment variables
66
const getAuthConfig = () => {
@@ -36,7 +36,7 @@ const MONGODB_URI = process.env.MONGODB_URI ?? "mongodb://localhost:27017";
3636
const mongoClient = new MongoClient(MONGODB_URI);
3737

3838
export const auth = betterAuth({
39-
database: mongodbAdapter(mongoClient.db() as any),
39+
database: mongodbAdapter(mongoClient.db() as Db),
4040
baseURL: config.baseURL,
4141
emailAndPassword: {
4242
enabled: false,

0 commit comments

Comments
 (0)