react-idle-timer: Build fails due to missing dev dependency

Bug information

Affected Module

  • Version: 5.0.0

Describe the bug

Build fails with this message:

❯ yarn build
yarn run v1.22.17
$ tsc && vite build
../node_modules/react-idle-timer/dist/withIdleTimer.d.ts:2:26 - error TS2307: Cannot find module 'utility-types' or its corresponding type declarations.

2 import { Subtract } from 'utility-types';
                           ~~~~~~~~~~~~~~~


Found 1 error in ../node_modules/react-idle-timer/dist/withIdleTimer.d.ts:2

error Command failed with exit code 2.

To Reproduce

Steps to reproduce the behavior:

  1. Build it in a project (with Vite?)

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

System Information (please complete the following information)

  • OS: Ubuntu
  • Device: Desktop

Additional context

    "node": "16.13.2",
    "yarn": "1.22.17"

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@doron-cohen @mmichael0413 @ChrisZieba,

Published 5.1.3 to NPM. Now uses builtin Omit over utility-types Subtract. The project no longer depends on utility-types so you should be good to go. This is a good fix. Always like removing dependencies! Thanks for the report, feel free to re-open this if you are still having issues.

In production you run the compiled code and types are no longer needed so it should be fine. I will just remove utility types and use the typescript built ins.

Fixed it for me. Thank you so much for the quick response and fix!

Interestingly, I’m also seeing this error. Not too sure what the problem is yet. Screen Shot 2022-05-03 at 22 11 55