Skip to content

ci: add dist declaration typecheck to CI#8702

Merged
himself65 merged 1 commit intobetter-auth:canaryfrom
gustavovalverde:ci/dist-typecheck-validation
Mar 20, 2026
Merged

ci: add dist declaration typecheck to CI#8702
himself65 merged 1 commit intobetter-auth:canaryfrom
gustavovalverde:ci/dist-typecheck-validation

Conversation

@gustavovalverde
Copy link
Contributor

@gustavovalverde gustavovalverde commented Mar 20, 2026

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 e77e56e. Summary will update on new commits.

Add `typecheck:dist` that validates package source against workspace
dependencies' dist declarations instead of source (disables the
`dev-source` custom condition). This catches type errors that `pnpm
typecheck` misses due to `customConditions: ["dev-source"]` resolving
all imports to source `.ts` files.

Excludes `better-auth`, `core`, and `electron` source from the check
because their `declare module` augmentations conflict with their own
dist augmentations when both are visible to the compiler.

Context: see better-auth#8701 for the full explanation of the `dev-source`
masking issue.
Copilot AI review requested due to automatic review settings March 20, 2026 00:48
@vercel
Copy link

vercel bot commented Mar 20, 2026

@gustavovalverde is attempting to deploy a commit to the better-auth Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 20, 2026

Open in StackBlitz

@better-auth/api-key

npm i https://pkg.pr.new/@better-auth/api-key@8702

better-auth

npm i https://pkg.pr.new/better-auth@8702

auth

npm i https://pkg.pr.new/auth@8702

@better-auth/core

npm i https://pkg.pr.new/@better-auth/core@8702

@better-auth/drizzle-adapter

npm i https://pkg.pr.new/@better-auth/drizzle-adapter@8702

@better-auth/electron

npm i https://pkg.pr.new/@better-auth/electron@8702

@better-auth/expo

npm i https://pkg.pr.new/@better-auth/expo@8702

@better-auth/i18n

npm i https://pkg.pr.new/@better-auth/i18n@8702

@better-auth/kysely-adapter

npm i https://pkg.pr.new/@better-auth/kysely-adapter@8702

@better-auth/memory-adapter

npm i https://pkg.pr.new/@better-auth/memory-adapter@8702

@better-auth/mongo-adapter

npm i https://pkg.pr.new/@better-auth/mongo-adapter@8702

@better-auth/oauth-provider

npm i https://pkg.pr.new/@better-auth/oauth-provider@8702

@better-auth/passkey

npm i https://pkg.pr.new/@better-auth/passkey@8702

@better-auth/prisma-adapter

npm i https://pkg.pr.new/@better-auth/prisma-adapter@8702

@better-auth/redis-storage

npm i https://pkg.pr.new/@better-auth/redis-storage@8702

@better-auth/scim

npm i https://pkg.pr.new/@better-auth/scim@8702

@better-auth/sso

npm i https://pkg.pr.new/@better-auth/sso@8702

@better-auth/stripe

npm i https://pkg.pr.new/@better-auth/stripe@8702

@better-auth/telemetry

npm i https://pkg.pr.new/@better-auth/telemetry@8702

@better-auth/test-utils

npm i https://pkg.pr.new/@better-auth/test-utils@8702

commit: e77e56e

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a CI guardrail to catch TypeScript errors that only appear when consuming packages via their built dist declaration files (instead of monorepo “dev-source” resolution), preventing broken published typings from reaching users.

Changes:

  • Add a root tsconfig.dist-check.json that disables customConditions (turning off dev-source) and typechecks source against workspace packages’ dist declarations.
  • Add pnpm typecheck:dist script to run that configuration.
  • Run the new dist-declaration typecheck in CI after the existing build + typecheck steps.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tsconfig.dist-check.json New TS config that clears customConditions and scopes the dist-declaration typecheck to package sources while excluding known-conflicting packages.
package.json Adds typecheck:dist script invoking tsc -p tsconfig.dist-check.json.
.github/workflows/ci.yml Adds a “Typecheck dist declarations” step in the typecheck job after build/typecheck.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@himself65 himself65 added this pull request to the merge queue Mar 20, 2026
Merged via the queue into better-auth:canary with commit 8b54817 Mar 20, 2026
25 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants