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

TypeScript build fails #87

Closed
j-f1 opened this issue Dec 31, 2018 · 12 comments
Closed

TypeScript build fails #87

j-f1 opened this issue Dec 31, 2018 · 12 comments
Labels
bug Something isn't working
Projects

Comments

@j-f1
Copy link

j-f1 commented Dec 31, 2018

I’ve enabled the strict option in my tsconfig.json, and installing this package results in an error because it can’t find types for the useCallbag hook, even though I don’t use that hook. It seems to be trying to import the types for the use-callbag package, which don’t exist. Can you fix this error?

@benneq
Copy link
Contributor

benneq commented Jan 31, 2019

I have similar issues:

Could not find a declaration file for module 'use-callbag'. 
Could not find a declaration file for module 'use-onclickoutside'. 
Could not find a declaration file for module 'react-wait'

Maybe those typings should be a hard dependency for react-use?

@j-f1
Copy link
Author

j-f1 commented Jan 31, 2019

The problem with use-callbag is that it doesn’t even have typings for TS.

@streamich
Copy link
Owner

This is not a solution, but I think if you import individual hooks like

import myHook from 'react-use/lib/myHook';

it should work, or doesn't it?

@benneq
Copy link
Contributor

benneq commented Jan 31, 2019 via email

@streamich
Copy link
Owner

Well I'm using that approach, and that's why I haven't seen this TypeScript error and haven't had incentive to fix it, sorry for that 😃

@benneq
Copy link
Contributor

benneq commented Jan 31, 2019 via email

@streamich
Copy link
Owner

use-callbag and use-onclickoutside are not part of dependencies anymore. Do you still see this error?

@wardoost wardoost added the bug Something isn't working label Mar 31, 2019
@streamich streamich added this to To do in react-use via automation Jun 1, 2019
@dcporter
Copy link

Yes — react-wait is causing problems (looks like it has an @types (here)! 🎉), as are usePermission’s own types (several are not found).

@xobotyi
Copy link
Contributor

xobotyi commented Aug 19, 2019

@streamich maybe we should exclude react-wait from default export and add react-wait and @types/react-wait to the optionalDependencies?

@streamich
Copy link
Owner

react-wait types are now re-expoted, it works for me with Webpack.

@dcporter do see errors caused by react-wait when using latest version? What is your setup?

@dcporter
Copy link

It's looking very hopeful. I'll close this out once my local project's PR makes it all the way through the pipeline without mishap. Thanks! :D

@dcporter
Copy link

dcporter commented Sep 3, 2019

Looks good now, I'm able to import hooks from root! This presented as a binary "everything works or everything is broken" situation, so I'm confident that everything is in a stable place now.

Thanks a ton. (I realized that this is not my issue so I can't close it. But @j-f1 can!)

@j-f1 j-f1 closed this as completed Sep 3, 2019
react-use automation moved this from To do to Done Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
react-use
  
Done
Development

No branches or pull requests

6 participants