Skip to content

Use tsc for DTS emit in chai-openapi-response-validator; keep tsup for JS bundling#97

Merged
ehuelsmann merged 3 commits into
masterfrom
copilot/fix-ts-dts-build-failure
May 31, 2026
Merged

Use tsc for DTS emit in chai-openapi-response-validator; keep tsup for JS bundling#97
ehuelsmann merged 3 commits into
masterfrom
copilot/fix-ts-dts-build-failure

Conversation

Copy link
Copy Markdown

Copilot AI commented May 31, 2026

TypeScript 6 started failing declaration generation in @ehuelsmann/chai-openapi-response-validator during tsup’s DTS phase (TS5101 / deprecated baseUrl path). This PR applies the durable split build path: tsc emits declarations, tsup only bundles JS.

  • Build pipeline split (DTS via tsc, JS via tsup)

    • Disabled DTS generation in packages/chai-openapi-response-validator/tsup.config.ts (dts: false).
    • Updated package scripts to run declaration emit with tsc -p tsconfig.json --rootDir lib --types chai and keep tsup as the JS bundler.
    • Added a dedicated build:dts script and wired build to run:
      • dependency package build,
      • declaration emit,
      • JS bundle,
      • declaration emit (to preserve declarations in dist after tsup clean).
  • Package export type mapping alignment

    • Updated packages/chai-openapi-response-validator/package.json exports so both:
      • exports["."].import.types
      • exports["."].require.types
        point to ./dist/index.d.ts.
  • TypeScript config for declaration output

    • Minimized packages/chai-openapi-response-validator/tsconfig.json to declaration-oriented settings for the new path:
      • outDir: "dist"
      • emitDeclarationOnly: true
{
  "scripts": {
    "build:dts": "tsc -p tsconfig.json --rootDir lib --types chai",
    "build": "yarn build:openapi-validator && yarn build:dts && tsup && yarn build:dts"
  },
  "exports": {
    ".": {
      "import": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" },
      "require": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
    }
  }
}
Original prompt

Create a pull request in repository ehuelsmann/OpenAPIValidators to implement the minimal durable fix for the TypeScript 6 DTS build failure in @ehuelsmann/chai-openapi-response-validator.

Context:

  • The failing CI job shows the JS bundle succeeds, but the DTS build fails with TS5101: Option 'baseUrl' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
  • The failure occurs during tsup declaration generation, not during the JS bundle step.
  • We want option 1 only: keep tsup for JS bundling and use tsc for declaration generation.
  • Do not implement the quick fix using ignoreDeprecations.
  • Do not convert the package to a full tsc-only build.

Required changes:

  1. Update packages/chai-openapi-response-validator/tsup.config.ts

    • Keep the existing entry / formats / clean / sourcemap / tsconfig settings.
    • Disable DTS generation in tsup by setting dts: false.
  2. Update packages/chai-openapi-response-validator/package.json

    • Change the build script so it runs tsc -p tsconfig.json before tsup, while preserving the existing dependency build step.
    • Keep tsup responsible for JS bundling.
    • Update the package exports so both import.types and require.types point to ./dist/index.d.ts.
    • Keep the rest of the package metadata unchanged unless a small adjustment is required for consistency.
  3. Update packages/chai-openapi-response-validator/tsconfig.json

    • Ensure it works cleanly for declaration generation via tsc into dist.
    • Keep the file minimal; only make changes needed to support the new declaration-generation path.

Validation expectations:

  • The package should still emit CJS and ESM JS bundles via tsup.
  • Type declarations should be emitted by tsc into dist.
  • The package metadata should correctly reference the declaration output.
  • If there are any follow-up adjustments needed for declaration output naming or ordering, include them in the PR.

Please make the code changes and open a PR.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.

Assistant: The failure is caused by TypeScript 6 rejecting the deprecated baseUrl option during the DTS build for @ehuelsmann/chai-openapi-response-validator.

Where it fails:

Root cause:

Recommended fix:
Add ignoreDeprecations: "6.0" to the root tsconfig.json under compilerOptions.

Suggested patch:

{
  "files": ["./types/combos.d.ts"],
  "compilerOptions": {
    "target": "ES2018",
    "lib": ["ES2018", "ES2022.Error"],
    "module": "node16",
    "moduleResolution": "node16",
    "declaration": true,
    "declarationMap": true,
    "sourceMap": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "strictBindCallApply": true,
    "strictPropertyInitialization": true,
    "noImplicitThis": true,
    "useUnknownInCatchVariables": true,
    "alwaysStrict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "exactOptionalPropertyTypes": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "noUncheckedIndexedAccess": true,
    "noImplicitOverride": true,
    "noPropertyAccessFromIndexSignature": true,
    "allowUnusedLabels": false,
    "allowUnre...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

Copilot AI changed the title [WIP] Implement minimal fix for TypeScript 6 DTS build failure Use tsc for DTS emit in chai-openapi-response-validator; keep tsup for JS bundling May 31, 2026
Copilot AI requested a review from ehuelsmann May 31, 2026 09:56
@codecov
Copy link
Copy Markdown

codecov Bot commented May 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (0c5dfd5) to head (6f6be4c).

Additional details and impacted files
@@            Coverage Diff            @@
##            master       #97   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           16        16           
  Lines          410       410           
  Branches        77        77           
=========================================
  Hits           410       410           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ehuelsmann ehuelsmann marked this pull request as ready for review May 31, 2026 10:15
@ehuelsmann ehuelsmann merged commit 15246fd into master May 31, 2026
7 checks passed
@ehuelsmann ehuelsmann deleted the copilot/fix-ts-dts-build-failure branch May 31, 2026 10:20
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.

2 participants