Skip to content

Commit 3ebc1a2

Browse files
fix(cli): add BetterAuthOptions type to betterAuth imports for improved type safety
1 parent 0eb3bf8 commit 3ebc1a2

File tree

1 file changed

+10
-10
lines changed
  • apps/cli/templates/auth/better-auth/server/base/src/lib

1 file changed

+10
-10
lines changed

apps/cli/templates/auth/better-auth/server/base/src/lib/auth.ts.hbs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{{#if (eq orm "prisma")}}
2-
import { betterAuth } from "better-auth";
2+
import { betterAuth, type BetterAuthOptions } from "better-auth";
33
import { prismaAdapter } from "better-auth/adapters/prisma";
44
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
55
import { expo } from "@better-auth/expo";
66
{{/if}}
77
import prisma from "../db";
88

9-
export const auth = betterAuth({
9+
export const auth = betterAuth<BetterAuthOptions>({
1010
database: prismaAdapter(prisma, {
1111
{{#if (eq database "postgres")}}provider: "postgresql"{{/if}}
1212
{{#if (eq database "sqlite")}}provider: "sqlite"{{/if}}
@@ -37,15 +37,15 @@ export const auth = betterAuth({
3737

3838
{{#if (eq orm "drizzle")}}
3939
{{#if (or (eq runtime "bun") (eq runtime "node"))}}
40-
import { betterAuth } from "better-auth";
40+
import { betterAuth, type BetterAuthOptions } from "better-auth";
4141
import { drizzleAdapter } from "better-auth/adapters/drizzle";
4242
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
4343
import { expo } from "@better-auth/expo";
4444
{{/if}}
4545
import { db } from "../db";
4646
import * as schema from "../db/schema/auth";
4747

48-
export const auth = betterAuth({
48+
export const auth = betterAuth<BetterAuthOptions>({
4949
database: drizzleAdapter(db, {
5050
{{#if (eq database "postgres")}}provider: "pg",{{/if}}
5151
{{#if (eq database "sqlite")}}provider: "sqlite",{{/if}}
@@ -75,7 +75,7 @@ export const auth = betterAuth({
7575
{{/if}}
7676

7777
{{#if (eq runtime "workers")}}
78-
import { betterAuth } from "better-auth";
78+
import { betterAuth, type BetterAuthOptions } from "better-auth";
7979
import { drizzleAdapter } from "better-auth/adapters/drizzle";
8080
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
8181
import { expo } from "@better-auth/expo";
@@ -84,7 +84,7 @@ import { db } from "../db";
8484
import * as schema from "../db/schema/auth";
8585
import { env } from "cloudflare:workers";
8686

87-
export const auth = betterAuth({
87+
export const auth = betterAuth<BetterAuthOptions>({
8888
database: drizzleAdapter(db, {
8989
{{#if (eq database "postgres")}}provider: "pg",{{/if}}
9090
{{#if (eq database "sqlite")}}provider: "sqlite",{{/if}}
@@ -117,14 +117,14 @@ export const auth = betterAuth({
117117
{{/if}}
118118

119119
{{#if (eq orm "mongoose")}}
120-
import { betterAuth } from "better-auth";
120+
import { betterAuth, type BetterAuthOptions } from "better-auth";
121121
import { mongodbAdapter } from "better-auth/adapters/mongodb";
122122
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
123123
import { expo } from "@better-auth/expo";
124124
{{/if}}
125125
import { client } from "../db";
126126

127-
export const auth = betterAuth({
127+
export const auth = betterAuth<BetterAuthOptions>({
128128
database: mongodbAdapter(client),
129129
trustedOrigins: [
130130
process.env.CORS_ORIGIN || "",
@@ -149,12 +149,12 @@ export const auth = betterAuth({
149149
{{/if}}
150150

151151
{{#if (eq orm "none")}}
152-
import { betterAuth } from "better-auth";
152+
import { betterAuth, type BetterAuthOptions } from "better-auth";
153153
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
154154
import { expo } from "@better-auth/expo";
155155
{{/if}}
156156

157-
export const auth = betterAuth({
157+
export const auth = betterAuth<BetterAuthOptions>({
158158
database: "", // Invalid configuration
159159
trustedOrigins: [
160160
process.env.CORS_ORIGIN || "",

0 commit comments

Comments
 (0)