-
Notifications
You must be signed in to change notification settings - Fork 133
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 TypeScript definition file #176
base: master
Are you sure you want to change the base?
Conversation
still need to: - verify all the routes are documented - add a return type for all Promises - only add the verb methods that are actually valid
@@ -4,6 +4,7 @@ | |||
"description": "Javascript GitHub client for NodeJS or a browser using promises or callbacks", | |||
"main": "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.
Can you add types
field like "types": "./types/index.d.ts"
?
Including declarations in your npm package
https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html
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.
Thank you for catching that oversight. Updated 😄
What's the current status of this? Would love to see typing information available! |
Any update on this? I tried it now and it fails (types are not consistent with the actual commands) |
This adds a TypeScript definition file (see
./types/index.d.ts
) for Octokat.You can test it out by doing the following:
./types/index.d.ts
file into your project by putting it in/local-types/octokat/index.d.ts
/tsconfig.json
:TODO
octo.repos('philschatz', 'octokat.js').issues(3).comments
).fetch(...)
,.update(...)
)Promise
is resolved (instead ofPromise<any>
)repos
andissues
inocto.repos(...).issues.fetch()
Examples
This shows that the request is typed (via dot-completion in Atom):
This shows that the server response is also typed (via dot-completion in Atom):