[PR #8981] [MERGED] fix(types): prevent any from collapsing base type and client inference #16591

Closed
opened 2026-04-13 10:35:52 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8981
Author: @bytaesu
Created: 4/6/2026
Status: Merged
Merged: 4/6/2026
Merged by: @gustavovalverde

Base: mainHead: 2026-04-06/fix/type-any-guards


📝 Commits (4)

  • 997c1c6 refactor: add IsAny helper type
  • 38b93a6 fix(types): guard utility types against any poisoning using IsAny
  • 4c839c9 test(types): strengthen any-poisoning test assertions
  • a0155c1 chore: add changeset

📊 Changes

6 files changed (+126 additions, -51 deletions)

View changed files

.changeset/violet-papayas-see.md (+5 -0)
📝 packages/better-auth/src/client/path-to-object.ts (+23 -17)
📝 packages/better-auth/src/types/helper.ts (+38 -7)
📝 packages/better-auth/src/types/models.ts (+11 -11)
📝 packages/better-auth/src/types/plugins.ts (+10 -10)
📝 packages/better-auth/src/types/types.test.ts (+39 -6)

📄 Description

  • auth.$Infer no longer collapses to any when an untyped plugin is present
  • auth.$ERROR_CODES preserves error code literals even with an untyped plugin
  • Client query parameters stay typed on endpoints where body is any

Reference: https://github.com/microsoft/TypeScript/pull/45711


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/8981 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 4/6/2026 **Status:** ✅ Merged **Merged:** 4/6/2026 **Merged by:** [@gustavovalverde](https://github.com/gustavovalverde) **Base:** `main` ← **Head:** `2026-04-06/fix/type-any-guards` --- ### 📝 Commits (4) - [`997c1c6`](https://github.com/better-auth/better-auth/commit/997c1c63431ce5655bd9ca6fbd8a5ed1a9a0cbae) refactor: add IsAny helper type - [`38b93a6`](https://github.com/better-auth/better-auth/commit/38b93a621a6301ddd1f4c5317a887b2511803209) fix(types): guard utility types against any poisoning using IsAny - [`4c839c9`](https://github.com/better-auth/better-auth/commit/4c839c9a0d07edea862ddd71a1269a05729f4a2d) test(types): strengthen any-poisoning test assertions - [`a0155c1`](https://github.com/better-auth/better-auth/commit/a0155c1af45dafacdb47875de11e2051c6521c7d) chore: add changeset ### 📊 Changes **6 files changed** (+126 additions, -51 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/violet-papayas-see.md` (+5 -0) 📝 `packages/better-auth/src/client/path-to-object.ts` (+23 -17) 📝 `packages/better-auth/src/types/helper.ts` (+38 -7) 📝 `packages/better-auth/src/types/models.ts` (+11 -11) 📝 `packages/better-auth/src/types/plugins.ts` (+10 -10) 📝 `packages/better-auth/src/types/types.test.ts` (+39 -6) </details> ### 📄 Description - auth.$Infer no longer collapses to `any` when an untyped plugin is present - auth.$ERROR_CODES preserves error code literals even with an untyped plugin - Client query parameters stay typed on endpoints where `body` is `any` Reference: https://github.com/microsoft/TypeScript/pull/45711 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 10:35:52 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#16591