diff --git a/.changeset/oauth-provider-exact-optional-property-types.md b/.changeset/oauth-provider-exact-optional-property-types.md new file mode 100644 index 0000000000..34b800f0b8 --- /dev/null +++ b/.changeset/oauth-provider-exact-optional-property-types.md @@ -0,0 +1,7 @@ +--- +"better-auth": patch +"@better-auth/oauth-provider": patch +"@better-auth/mcp": patch +--- + +Projects that enable `exactOptionalPropertyTypes` can use the `oauthProvider()` and `mcp()` plugins again. Since 1.7.0, adding either plugin to `betterAuth()` failed to type-check with a TS2322 error. diff --git a/e2e/smoke/test/fixtures/tsconfig-exact-optional-property-types/package.json b/e2e/smoke/test/fixtures/tsconfig-exact-optional-property-types/package.json index d266cf2fa1..99fabad8dd 100644 --- a/e2e/smoke/test/fixtures/tsconfig-exact-optional-property-types/package.json +++ b/e2e/smoke/test/fixtures/tsconfig-exact-optional-property-types/package.json @@ -9,6 +9,8 @@ "dependencies": { "better-auth": "workspace:*", "@better-auth/sso": "workspace:*", - "@better-auth/passkey": "workspace:*" + "@better-auth/passkey": "workspace:*", + "@better-auth/oauth-provider": "workspace:*", + "@better-auth/mcp": "workspace:*" } } diff --git a/e2e/smoke/test/fixtures/tsconfig-exact-optional-property-types/src/mcp.ts b/e2e/smoke/test/fixtures/tsconfig-exact-optional-property-types/src/mcp.ts new file mode 100644 index 0000000000..474a394d68 --- /dev/null +++ b/e2e/smoke/test/fixtures/tsconfig-exact-optional-property-types/src/mcp.ts @@ -0,0 +1,15 @@ +/** + * @see https://github.com/better-auth/better-auth/issues/10213 + */ +import { mcp } from "@better-auth/mcp"; +import { betterAuth } from "better-auth"; + +export const auth = betterAuth({ + plugins: [ + mcp({ + resource: "https://example.com/mcp", + loginPage: "/login", + consentPage: "/consent", + }), + ], +}); diff --git a/e2e/smoke/test/fixtures/tsconfig-exact-optional-property-types/src/oauth-provider.ts b/e2e/smoke/test/fixtures/tsconfig-exact-optional-property-types/src/oauth-provider.ts new file mode 100644 index 0000000000..9a7b98805b --- /dev/null +++ b/e2e/smoke/test/fixtures/tsconfig-exact-optional-property-types/src/oauth-provider.ts @@ -0,0 +1,14 @@ +/** + * @see https://github.com/better-auth/better-auth/issues/10213 + */ +import { oauthProvider } from "@better-auth/oauth-provider"; +import { betterAuth } from "better-auth"; + +export const auth = betterAuth({ + plugins: [ + oauthProvider({ + loginPage: "/login", + consentPage: "/consent", + }), + ], +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c51dd12d28..dbe619aead 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,8 +13,8 @@ catalogs: specifier: 1.3.2 version: 1.3.2 better-call: - specifier: 1.4.1 - version: 1.4.1 + specifier: 1.4.2 + version: 1.4.2 nanostores: specifier: ^1.3.0 version: 1.3.0 @@ -936,6 +936,12 @@ importers: e2e/smoke/test/fixtures/tsconfig-exact-optional-property-types: dependencies: + '@better-auth/mcp': + specifier: workspace:* + version: link:../../../../../packages/mcp + '@better-auth/oauth-provider': + specifier: workspace:* + version: link:../../../../../packages/oauth-provider '@better-auth/passkey': specifier: workspace:* version: link:../../../../../packages/passkey @@ -981,7 +987,7 @@ importers: version: 0.5.0 better-call: specifier: 'catalog:' - version: 1.4.1(zod@4.5.4) + version: 1.4.2(zod@4.5.4) zod: specifier: 'catalog:' version: 4.5.4 @@ -1036,7 +1042,7 @@ importers: version: 7.4.1(prisma@7.4.1(@types/react@19.2.17)(better-sqlite3@12.11.1)(react-dom@19.2.7(react@19.2.7))(react@19.2.7)(typescript@6.0.3))(typescript@6.0.3) better-call: specifier: 'catalog:' - version: 1.4.1(zod@4.5.4) + version: 1.4.2(zod@4.5.4) defu: specifier: '>=6.1.5 <7' version: 6.1.7 @@ -1154,7 +1160,7 @@ importers: dependencies: better-call: specifier: 'catalog:' - version: 1.4.1(zod@4.5.4) + version: 1.4.2(zod@4.5.4) devDependencies: '@better-auth/core': specifier: workspace:* @@ -1310,7 +1316,7 @@ importers: version: 2.10.0(@opentelemetry/api@1.9.1) better-call: specifier: 'catalog:' - version: 1.4.1(zod@4.5.4) + version: 1.4.2(zod@4.5.4) jose: specifier: ^6.2.3 version: 6.2.3 @@ -1352,7 +1358,7 @@ importers: version: 1.3.2 better-call: specifier: 'catalog:' - version: 1.4.1(zod@4.5.4) + version: 1.4.2(zod@4.5.4) conf: specifier: ^15.0.2 version: 15.1.0 @@ -1386,7 +1392,7 @@ importers: version: 1.3.2 better-call: specifier: 'catalog:' - version: 1.4.1(zod@4.5.4) + version: 1.4.2(zod@4.5.4) zod: specifier: 'catalog:' version: 4.5.4 @@ -1481,7 +1487,7 @@ importers: version: link:../better-auth better-call: specifier: 'catalog:' - version: 1.4.1(zod@4.5.4) + version: 1.4.2(zod@4.5.4) tsdown: specifier: 'catalog:' version: 0.21.10(@arethetypeswrong/core@0.18.3)(oxc-resolver@11.21.3)(publint@0.3.21)(typescript@6.0.3) @@ -1529,7 +1535,7 @@ importers: version: 1.3.2 better-call: specifier: 'catalog:' - version: 1.4.1(zod@4.5.4) + version: 1.4.2(zod@4.5.4) jose: specifier: ^6.2.3 version: 6.2.3 @@ -1569,7 +1575,7 @@ importers: version: 13.3.1 better-call: specifier: 'catalog:' - version: 1.4.1(zod@4.5.4) + version: 1.4.2(zod@4.5.4) zod: specifier: 'catalog:' version: 4.5.4 @@ -1701,7 +1707,7 @@ importers: version: link:../better-auth better-call: specifier: 'catalog:' - version: 1.4.1(zod@4.5.4) + version: 1.4.2(zod@4.5.4) zod: specifier: 'catalog:' version: 4.5.4 @@ -1772,7 +1778,7 @@ importers: version: link:../better-auth better-call: specifier: 'catalog:' - version: 1.4.1(zod@4.5.4) + version: 1.4.2(zod@4.5.4) body-parser: specifier: ^2.3.0 version: 2.3.0 @@ -1806,7 +1812,7 @@ importers: version: link:../better-auth better-call: specifier: 'catalog:' - version: 1.4.1(zod@4.5.4) + version: 1.4.2(zod@4.5.4) stripe: specifier: ^22.0.1 version: 22.0.1(@types/node@25.9.4) @@ -8244,8 +8250,8 @@ packages: peerDependencies: better-auth: ^1.0.3 - better-call@1.4.1: - resolution: {integrity: sha512-O5CIGC6wlJtfMZy8Yl4uRsNoHyAnwsAIQwAy5bRvqhmH+ha7+hXMx1Ujvb5K9pJ/NMm/GH3l3HL5nSMzVaoMNA==} + better-call@1.4.2: + resolution: {integrity: sha512-lOmFCTG1KcE60YWxoff2Wx0Fv7v7drP/fQTDYnhJUCdkA7V6QWXdLPUiMpOQCq7Fd0Ts3AkrRwD23xoiootlGA==} peerDependencies: zod: 4.5.4 peerDependenciesMeta: @@ -24281,7 +24287,7 @@ snapshots: mailchecker: 6.0.19 validator: 13.15.26 - better-call@1.4.1(zod@4.5.4): + better-call@1.4.2(zod@4.5.4): dependencies: '@better-auth/utils': 0.5.0 '@better-fetch/fetch': 1.3.2 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 4fed195a85..5de47dae1a 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -66,7 +66,7 @@ overrides: catalog: '@better-auth/utils': 0.5.0 '@better-fetch/fetch': 1.3.2 - better-call: 1.4.1 + better-call: 1.4.2 kysely: ^0.28.17 || ^0.29.0 nanostores: ^1.3.0 tsdown: 0.21.10