xnimorz / use-debounce

A debounce hook for react

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[9.0.1] TS7016: Could not find a declaration file for module 'use-debounce'.

efstathiosntonas opened this issue · comments

Describe the bug
After upgrading to 9.0.1 the types are broken.

TS7016: Could not find a declaration file for module 'use-debounce'.

To Reproduce
Upgrade to 9.0.1 on a typescript project

use-debounce version:
9.0.1

commented

Same problem here...

Same here.


9.0.0 has the same issue.

commented

Hey all!
Sorry for inconvenience. I’ll fix it within a day.
for now please use 8.0.4

@xnimorz I think it's broken on react-native too, it throws this:

Error: While trying to resolve module `use-debounce` from file `/Users/stathis/WebstormProjects/src/xxxx.tsx`, the package `/Users/stathis/WebstormProjects/xxxxxx/node_modules/use-debounce/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/stathis/WebstormProjects/xxxxx/node_modules/use-debounce/dist/index.cjs`. Indeed, none of these files exist:

commented

Okay, So I've reverted recent 9.0.0 changes, and it should be back to normal.

You can use 9.0.2, it should work fine

9.0.2 works brilliantly!

@xnimorz Thank you very much! 🙇

I still get this issue with 9.0.3 in combination with TypeScript 5.0.2 and nodeResolution set to the new bundler option:

Content/Test.tsx:5:38 - error TS7016: Could not find a declaration file for module 'use-debounce'. 'D:/Test/.yarn/__virtual__/use-debounce-virtual-e226286c71/0/cache/use-debounce-npm-9.0.3-87fc1a9d59-e9aa3b89ab.zip/node_modules/use-debounce/dist/index.module.js' implicitly has an 'any' type.
  There are types at 'D:/Test/.yarn/__virtual__/use-debounce-virtual-e226286c71/0/cache/use-debounce-npm-9.0.3-87fc1a9d59-e9aa3b89ab.zip/node_modules/use-debounce/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'use-debounce' library may need to update its package.json or typings.

5 import { useDebouncedCallback } from 'use-debounce';

Updating to 9.0.4 fixes the issue. It worked for me on nodeResolution: bundler