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

Add typings for imports in Typescript #2

Closed
electrovir opened this issue Mar 5, 2020 · 6 comments · Fixed by #3
Closed

Add typings for imports in Typescript #2

electrovir opened this issue Mar 5, 2020 · 6 comments · Fixed by #3
Labels
enhancement New feature or request

Comments

@electrovir
Copy link
Contributor

Getting a Could not find a declaration file for module 'human-signals'. when importing this in Typescript, such as in the following:

import {signalsByName} from 'human-signals';

Also @types/human-signals does not exist in npm.

Happy to assist if needed.

@electrovir electrovir added the enhancement New feature or request label Mar 5, 2020
@ehmicky
Copy link
Owner

ehmicky commented Mar 5, 2020

Hi @electrovir,
Absolutely, types would be a great idea!

This might be a little tricky since the properties of the exported objects is dynamic as it depends on process.platform.

This probably should be either a src/main.ts.d ambient file or a @types/human-signals package (as opposed to either rewriting *.js to *.ts).

If you want to give it a go, please let me know!

@electrovir
Copy link
Contributor Author

I was thinking a .d.ts file actually in the repo of some sort would be best, like you mentioned as an option.

I'll take a crack at it! I just started using this package so I can test it in actual use. I'll put it in src/main.d.ts as you suggested :)

@ehmicky
Copy link
Owner

ehmicky commented Mar 6, 2020

Thanks for the PR!
The release is pending due to a bug in Node.js 13.10.0 which should be fixed anytime soon.

@electrovir
Copy link
Contributor Author

You're welcome, it was fun! 🎉

@ehmicky
Copy link
Owner

ehmicky commented Mar 14, 2020

Released in 2.1.0!

@electrovir
Copy link
Contributor Author

Finally got around to updating. Looks good, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants