-
Notifications
You must be signed in to change notification settings - Fork 41
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 typings #47
Conversation
Hi, thanks for contributing! Please undo the second commit (lts/carbon test) as it is not related to TypeScript support. I'll look closer into these changes in the coming days. Thanks again! |
OK, I removed the second commit. |
This is a very welcome addition, and it seems to work fine, at least on the project I tested, thanks! EDIT: actually, I stand corrected, I do have some issues regarding name conflicts (using Typescript 2.3.2) |
@@ -0,0 +1,7 @@ | |||
declare module 'express-promise-router' { |
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 are importing Router
to the scope, and then redefining a Router
function, which at least on my version of typescript leads to a conflict
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.
I'm using 2.5.3,and works fine.
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.
I tried to upgrade to 2.6.2, and the problem still maintains itself:
node_modules/express-promise-router/index.d.ts(2,13): error TS2440: Import declaration conflicts with local declaration of 'Router'.
.
Still, the fix is pretty simple:
import {Router as RouterExpress, RouterOptions} from 'express'
function Router(options?: RouterOptions): RouterExpress
export = Router
}
What do you think?
Unfortunately i haven't used TypeScript (active FlowType user), but i still would want to try this out before merging. I'll see when i can fit it in :) |
Hi, i'm exploring options to test the TypeScript definition as part of the test suite. So far i've found I created a really simple test case using @bangbang93 do you think it's possible to implement his workaround?
When i have some spare time i might bring my initial test into a presentable form and add it here. Moritz |
Hi, we need tests for this before merging it. I prepared tests but can't commit/push it to your PR. Did you disable "Allow edits from maintainers"? Moritz |
Mhm i cloned your repo and committed there, don't know if thats the intended way to do this, i thought i could just push on pr/43.. Oh well 🤷🏻♂️ I'll look into why the test fails this weekend! Moritz |
Was this supposed to add EDIT: As an aside, what's the breaking change that prompted the major version bump? |
Oh you're totally right! I don't actually know what the best practice is here, but i suppose we can just remove the peerDependency. Are there any downsides for TypeScript users? Otherwise i'd push a fix in a few minutes. |
To be honest, there is not enough testing from users / contributors of this library. So I released it as a major version to reduce the risk of breaking anything as many people still don't use pinned versions. I do plan to change this for the next releases. But i would like to have a few people join me in testing changes. I deploy these changes (-beta, -rc, etc.) to production on my projects before releasing the final version, but my testing might not be enough. Basically i'm over cautious because i'm the only tester. |
Fair enough. For what it's worth, the general approach with semantic versioning is to treat the documentation as authorative; that is, whatever the documentation says the API is should be what the API actually is, and if the documented API hasn't broken in an incompatible way then it's not a breaking release. Bugfixes ("bring the actual behaviour in line with the documented behaviour") are then considered a patch release. This solves a number of conundrums:
I wouldn't worry too much about breakage due to not locking package versions; any automatic updates happen during deployment steps anyway, when a human is paying attention and can test their deployment. Those who are hesitant about automatically getting updates that might break their application (and who can afford the time to vet every update manually!) can already use version pinning anyway. I actually often recommend that people don't use version pinning, because the cost of continuously tracking and vetting updates is considerably higher than dealing with the occasional breakage, and most people don't have teams of developers to do this task around the clock. But in the end it's up to the developer which side of the tradeoff to pick, anyway - and in that context it's totally okay to release a patch/minor release even if you think there may still be undiscovered bugs. It's desirable, even; those who opt into automatic updates won't automatically get the updates if they're stuck on the wrong major version. Either way, thanks for the speedy fix :) |
No description provided.