import { betterAuth } from "./packages/better-auth/src/auth";
import { expectTypeOf, describe, it } from "vitest";
// Instance with empty plugins array
const authWithEmptyPlugins = betterAuth({
plugins: [],
secret: "test-secret",
emailAndPassword: {
enabled: true,
},
});
// No plugins property
const authWithoutPlugins = betterAuth({
secret: "test-secret",
emailAndPassword: {
enabled: true,
},
});
type SessionWithEmptyPlugins = typeof authWithEmptyPlugins.$Infer.Session;
type SessionWithoutPlugins = typeof authWithoutPlugins.$Infer.Session;
describe("Empty Plugins Type Inference", () => {
it("should have equal types for empty plugins and no plugins (server)", () => {
// Type error here
expectTypeOf<SessionWithEmptyPlugins>().toEqualTypeOf<SessionWithoutPlugins>();
});
});
import { betterAuth } from "./packages/better-auth/src/auth";
import { expectTypeOf, describe, it } from "vitest";
// Instance with empty plugins array
const authWithEmptyPlugins = betterAuth({
plugins: [],
secret: "test-secret",
emailAndPassword: {
enabled: true,
},
});
// No plugins property
const authWithoutPlugins = betterAuth({
secret: "test-secret",
emailAndPassword: {
enabled: true,
},
});
type SessionWithEmptyPlugins = typeof authWithEmptyPlugins.$Infer.Session;
type SessionWithoutPlugins = typeof authWithoutPlugins.$Infer.Session;
describe("Empty Plugins Type Inference", () => {
it("should have equal types for empty plugins and no plugins (server)", () => {
// Type error here
expectTypeOf<SessionWithEmptyPlugins>().toEqualTypeOf<SessionWithoutPlugins>();
});
});