[PR #8702] [MERGED] ci: add dist declaration typecheck to CI #25059

Closed
opened 2026-04-15 22:42:35 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8702
Author: @gustavovalverde
Created: 3/20/2026
Status: Merged
Merged: 3/20/2026
Merged by: @himself65

Base: canaryHead: ci/dist-typecheck-validation


📝 Commits (1)

  • e77e56e ci: add dist declaration typecheck to CI

📊 Changes

3 files changed (+26 additions, -1 deletions)

View changed files

📝 .github/workflows/ci.yml (+3 -0)
📝 package.json (+2 -1)
tsconfig.dist-check.json (+21 -0)

📄 Description

Summary

Follow-up to #8701 — adds CI validation that catches dist declaration type errors before they reach consumers.

What it does

Adds a typecheck:dist step that typechecks package source against workspace dependencies' dist .d.mts declarations instead of source files. This disables the customConditions: ["dev-source"] condition that normally resolves all imports to source .ts.

Why it's needed

The monorepo's pnpm typecheck (tsc --build) uses dev-source to resolve workspace imports to source, so type errors in dist declarations are invisible. #8701 fixed 8 such errors in oauth-provider — this CI step prevents new ones.

Check What it validates When it catches errors
pnpm typecheck Source against source Always (but masks dist issues)
pnpm typecheck:dist Source against dist declarations When dist types diverge from source
pnpm lint:types (attw) Export resolution correctness When package.json exports are wrong

How it works

tsconfig.dist-check.json extends the base config but:

  • Clears customConditions (disables dev-source)
  • Sets composite: false + noEmit: true
  • Excludes better-auth, core, electron source (their declare module augmentations conflict with their own dist when both are visible)

Summary by cubic

Adds a CI step to typecheck against built dist declarations to catch type errors that pnpm typecheck misses due to the dev-source condition. Prevents regressions like the issues found in #8701 from reaching consumers.

  • New Features
    • Adds typecheck:dist (uses tsconfig.dist-check.json) and runs it in CI after Typecheck.
    • Resolves workspace imports against dist .d.mts instead of source.
    • Excludes better-auth, core, and electron sources to avoid module augmentation conflicts.

Written for commit e77e56e125. Summary will update on new commits.


🔄 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/8702 **Author:** [@gustavovalverde](https://github.com/gustavovalverde) **Created:** 3/20/2026 **Status:** ✅ Merged **Merged:** 3/20/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `ci/dist-typecheck-validation` --- ### 📝 Commits (1) - [`e77e56e`](https://github.com/better-auth/better-auth/commit/e77e56e125242354609744110fa0ff171e8821f5) ci: add dist declaration typecheck to CI ### 📊 Changes **3 files changed** (+26 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yml` (+3 -0) 📝 `package.json` (+2 -1) ➕ `tsconfig.dist-check.json` (+21 -0) </details> ### 📄 Description ## Summary Follow-up to #8701 — adds CI validation that catches dist declaration type errors before they reach consumers. ### What it does Adds a `typecheck:dist` step that typechecks package source against workspace dependencies' **dist `.d.mts` declarations** instead of source files. This disables the `customConditions: ["dev-source"]` condition that normally resolves all imports to source `.ts`. ### Why it's needed The monorepo's `pnpm typecheck` (`tsc --build`) uses `dev-source` to resolve workspace imports to source, so type errors in dist declarations are invisible. #8701 fixed 8 such errors in `oauth-provider` — this CI step prevents new ones. | Check | What it validates | When it catches errors | |---|---|---| | `pnpm typecheck` | Source against source | Always (but masks dist issues) | | `pnpm typecheck:dist` | Source against dist declarations | When dist types diverge from source | | `pnpm lint:types` (`attw`) | Export resolution correctness | When package.json exports are wrong | ### How it works `tsconfig.dist-check.json` extends the base config but: - Clears `customConditions` (disables `dev-source`) - Sets `composite: false` + `noEmit: true` - Excludes `better-auth`, `core`, `electron` source (their `declare module` augmentations conflict with their own dist when both are visible) <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds a CI step to typecheck against built dist declarations to catch type errors that `pnpm typecheck` misses due to the `dev-source` condition. Prevents regressions like the issues found in #8701 from reaching consumers. - **New Features** - Adds `typecheck:dist` (uses `tsconfig.dist-check.json`) and runs it in CI after Typecheck. - Resolves workspace imports against dist `.d.mts` instead of source. - Excludes `better-auth`, `core`, and `electron` sources to avoid module augmentation conflicts. <sup>Written for commit e77e56e125242354609744110fa0ff171e8821f5. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <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-15 22:42:35 -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#25059