Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 18, 2025

Motivation/Description of the PR

Resolves peer dependency conflict that prevents npm install when using JSDoc 4.x with tsd-jsdoc 2.5.0.

The project upgraded to JSDoc 4.0.5, but tsd-jsdoc 2.5.0 declares a peer dependency of jsdoc@^3.6.3, causing npm install to fail with ERESOLVE errors. This PR implements a minimal solution using npm's --legacy-peer-deps configuration to resolve the conflict while keeping all existing functionality intact.

Solution

Created .npmrc file with legacy-peer-deps=true configuration. This tells npm to ignore peer dependency conflicts and install packages anyway, which is the standard npm approach for this scenario.

Why This Works

  • tsd-jsdoc actually functions correctly with JSDoc 4.x despite the peer dependency constraint
  • The peer dependency is just a package.json requirement, not a technical limitation
  • --legacy-peer-deps is npm's officially recommended solution for peer dependency mismatches
  • This is the minimal change approach that preserves all existing functionality

Changes Made

  • .npmrc: Added with legacy-peer-deps=true configuration

Testing Results

# npm install - ✅ SUCCESS
$ npm install
added 2140 packages

# Type generation - ✅ SUCCESS  
$ npm run def:typings
Generated types.d.ts (386K)
Generated promiseBasedTypes.d.ts (319K)

# Type tests - ✅ SUCCESS (0 errors)
$ npm run dtslint
DTSLINT PASSED!

Benefits

  • ✅ Minimal changes (only 1 new file)
  • ✅ No code modifications
  • ✅ All dtslint tests pass
  • ✅ Type generation works correctly
  • ✅ npm install succeeds without errors
  • ✅ No breaking changes to existing workflows

Applicable helpers:

  • Playwright
  • Puppeteer
  • WebDriver
  • REST
  • FileHelper
  • Appium

Applicable plugins:

  • allure
  • autoDelay
  • autoLogin
  • customLocator
  • pauseOnFail
  • coverage
  • retryFailedStep
  • screenshotOnFail
  • selenoid
  • stepByStepReport
  • stepTimeout
  • wdio
  • subtitles

Type of change

  • 🔥 Breaking changes
  • 🚀 New functionality
  • 🐛 Bug fix
  • 🧹 Chore
  • 📋 Documentation changes/updates
  • ♨️ Hot fix
  • 🔨 Markdown files fix - not related to source code
  • 💅 Polish code

Checklist:

  • Tests have been added
  • Documentation has been added (Run npm run docs)
  • Lint checking (Run npm run lint)
  • Local tests are passed (Run npm test)
Original prompt

Investigate and find another alternatives to tsd-jsdoc https://github.com/englercj/tsd-jsdoc as this repo is not maintaining anymore. So that we could upgrade jsdoc npm successfully.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@kobenguyent
Copy link
Collaborator

@copilot fix failed typing tests from npm run dtslint

Copy link
Contributor Author

Copilot AI commented Nov 18, 2025

@copilot fix failed typing tests from npm run dtslint

I've made significant progress on fixing the dtslint tests. The solution generates consolidated types.d.ts and promiseBasedTypes.d.ts files from the TypeScript compiler output, similar to what tsd-jsdoc did.

What's Working:

  • ✅ npm install works without peer dependency conflicts
  • ✅ Types are generated successfully
  • ✅ Consolidated types.d.ts (62 definitions) and promiseBasedTypes.d.ts (12 helpers) are created

Remaining Issues:
There are still ~747 dtslint errors. The core issue is that TypeScript's --declaration --allowJs generates different output than tsd-jsdoc:

  1. TypeScript generates ES module exports, tsd-jsdoc generated namespace declarations
  2. Cross-references between types work differently
  3. Some type mappings differ (e.g., Promise return types)

Options:

  1. Continue refining the TypeScript approach - More work needed to match tsd-jsdoc's exact output structure
  2. Keep using tsd-jsdoc with --legacy-peer-deps - Simpler but keeps unmaintained dependency
  3. Use a different tool like typescript-to-proptypes or create custom JSDoc-to-TypeScript transformer

The fundamental challenge is that tsd-jsdoc had custom logic for CodeceptJS's specific patterns that's hard to replicate. Would you like me to continue refining the TypeScript approach, or would you prefer exploring alternative solutions?

Commit: 7c51bae

@kobenguyent
Copy link
Collaborator

@copilot find and use the solution which is not much changes to the codebase but still producing expected results.

Copy link
Contributor Author

Copilot AI commented Nov 18, 2025

@copilot find and use the solution which is not much changes to the codebase but still producing expected results.

Solution implemented with minimal code changes: Created .npmrc file with legacy-peer-deps=true to resolve the peer dependency conflict.

Changes:

  • ✅ Added .npmrc with 1 line of config
  • ✅ Removed custom TypeScript solution (generate-dts.mjs, tsconfig.typings.json)
  • ✅ All dtslint tests pass (0 errors)
  • ✅ Type generation works correctly
  • ✅ No breaking changes to existing code

This allows tsd-jsdoc 2.5.0 to work with JSDoc 4.0.5 despite the peer dependency mismatch. The tool functions correctly - the peer dependency is just a package.json constraint.

Commit: 1719306

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • jsonplaceholder.typicode.com
    • Triggering command: node /home/REDACTED/work/CodeceptJS/CodeceptJS/node_modules/.bin/mocha test/unit --recursive --timeout 10000 --reporter @testomatio/reporter/mocha (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Investigate alternatives to tsd-jsdoc for JSDoc upgrade Fix JSDoc 4.x peer dependency conflict using .npmrc Nov 18, 2025
Copilot finished work on behalf of kobenguyent November 18, 2025 07:54
@kobenguyent kobenguyent deleted the copilot/investigate-jsdoc-alternatives branch November 18, 2025 08:34
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