-
Notifications
You must be signed in to change notification settings - Fork 11
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
added definitions for TypeScript #9
Conversation
Hey @winfinit, thanks for your contribution. I've been wondering about that. As per what you are saying, if we describe a library interface in a If so, why do they created DefinitelyTyped (@types)? Furthermore, could you please provide me some reference that confirms this? Thank you again. |
We definitely want this. I am not so sure about the version bump you did (as a piece of advice, never do that, you don't know if the person wants to release after your PR or not. And even so, you don't know to which version). @brunokrebs So back in the day, the only way of doing typings was via DefinitelyTypes which after a few steps ended with the official solution of @types as you mention. That being said, a GOOD library can always provide the typings directly with the package. So only by installing the package via npm, you have typescript support out of the box without having to look for third party typings elsewhere. So yes, please, but remove the package bump. |
@@ -0,0 +1,21 @@ | |||
import Koa = require("koa"); |
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.
Do we really need this line? I am not sure, but I could be mistaken.
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.
yes, otherwise Koa.Middleware type is not going to get resolved
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.
Oh, right you are.
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.
You haven't added @types/koa
to dependencies
. This won't work.
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.
Take a look at the Dependencies section of this page.
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.
@brunokrebs added @types/koa to dev dependency list.
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.
Actually it should be added as in the dependencies
property. Otherwise, it won't work.
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.
@brunokrebs why would you want to add it to dependencies, it is a TypeScript dependency, which is used only during development phase
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.
@winfinit, exactly what I thought when I wrote this type definition. I first added it as a devDependency
and then why I wrote a small Koa application with TypeScript to test the definition, but it kept complaining about not being able to find @types/express-jwt
.
After that I saw that the publishing page on the TypeScript documentation states that the developer has to:
Make sure all the declaration packages you depend on are marked appropriately in the dependencies section in your package.json.
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.
@brunokrebs ah, just re-read that post, you are right, they are even saying this explicitly:
Our package exposes declarations from each of those, so any user of our browserify-typescript-extension package needs to have these dependencies as well. For that reason, we used "dependencies" and not "devDependencies", because otherwise our consumers would have needed to manually install those packages. If we had just written a command line application and not expected our package to be used as a library, we might have used devDependencies.
version bump was removed. I actually prefer in my packages when people bump a version, as long as they are following semver, that way I just need to merge and publish package, but hey, your package, your preference :) |
@Foxandxss and @brunokrebs is there anything outstanding for me? |
No, I am just busy with work :( |
@Foxandxss gotcha, there is no rush, just wanted to make sure that you are not waiting on me. Have fun! |
Can we merge this please? |
Hi, may be you can merge? |
@Foxandxss can you merge this please? :) |
added typings, so module is going to play nice with typescript, and won't require additional @types module.