Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Type definitions exported by @jest/test-result refer to dev dependency #15314

Open
johnameyer opened this issue Sep 19, 2024 · 2 comments

Comments

@johnameyer
Copy link

Version

29.7.0

Steps to reproduce

  1. npm i @jest/test-result@^29.7.0
  2. Import from package directly or indirectly in a typescript file e.g. echo "import * as testResult from '@jest/test-result';" > index.ts
  3. Attempt to compile npx tsc index.ts

https://stackblitz.com/edit/node-my9zod?file=index.ts,package.json,package-lock.json

(Real use case) https://stackblitz.com/edit/node-ru6fy9?file=index.ts,package.json

Expected behavior

No Typescript compilation errors

Actual behavior

Typescript error thrown

node_modules/@jest/test-result/build/index.d.ts:14:27 - error TS2307: Cannot find module 'jest-resolve' or its corresponding type declarations.

14 import type Resolver from 'jest-resolve';
                             ~~~~~~~~~~~~~~


Found 1 error in ../../node_modules/.pnpm/@[email protected]/node_modules/@jest/test-result/build/index.d.ts:14

Additional context

The type declarations of https://www.npmjs.com/package/@jest/test-result import from 'jest-resolve' despite it only being depended on as a dev dependency.

Environment

System:
    OS: Linux 5.0 undefined
    CPU: (6) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
@johnameyer johnameyer changed the title [Bug]: [Bug]: Type definitions exported by @jest/test-result refer to dev dependency Sep 19, 2024
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Oct 19, 2024
@SimenB
Copy link
Member

SimenB commented Oct 20, 2024

Happy to take a PR for this 👍

@github-actions github-actions bot removed the Stale label Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants