-
Notifications
You must be signed in to change notification settings - Fork 31
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
(Basic) Typescript support #511
Conversation
Codecov Report
@@ Coverage Diff @@
## master #511 +/- ##
=======================================
Coverage 99.00% 99.00%
=======================================
Files 24 24
Lines 303 303
Branches 40 40
=======================================
Hits 300 300
Misses 3 3 Continue to review full report at Codecov.
|
@johnrees this is awesome, thanks for the PR! I think this is a good starting point for a rewrite in TS since that would probably be preferable given all the parameters and options we have in the library. I have a local branch that started the process, perhaps now is the time to dust it off and start getting that going again. 🤔 |
"main": "src/index.js", | ||
"main": "dist/index.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @spencerkordecki :)
This might break the next publish, until the/dist
dir is included in the tarball that's pushed to npm.
I'll try and take a look later if you don't get to it, just wanted to warn you before the next npm publish
That's great to hear. I'll take a look next week. I started working on an extremely basic/crude TS api yesterday for an github action that I'm building as an internal PR deployment tool (it won't work without env vars yet), but I'd definitely prefer base it on something that's built & maintained by vultr! |
Description
This adds basic typescript types to the builds. Which helps with autocompletion when using the library.
Kapture.2021-08-13.at.10.19.08.mp4
Without rewriting the codebase in TS (perhaps this would be preferable?) or manually creating and tracking types like the @types project does I don't think it'll ever be perfect, but maybe it's a reasonable start?
Notes
vultr.account.getAccount()
(rather thanvultr.account.getAccount({})
:any
so TS isn't aware for instance thatvultr.account.getAccount({})
returns a Promise, and therefore doesn't autosuggest.then()
afterwardsRelated Issues
Addresses #393
Checklist: