-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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 new types for trouter #33557
Added new types for trouter #33557
Conversation
@stahlstift Thank you for submitting this PR! Because this is a new definition, a DefinitelyTyped maintainer will be reviewing this PR in the next few days once the Travis CI build passes. In the meantime, if the build fails or a merge conflict occurs, I'll let you know. Have a nice day! |
@stahlstift One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits or comments. Thank you! |
|
||
add(method: Trouter.ValidMethods, pattern: string, ...handlers: T[]): this; | ||
|
||
all(pattern: string, ...handlers: T[]): this; |
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.
Not important, but I feel like there ought to be a way to move all of these into a shared definition... possibly extending add
?
Something like this but for classes, of course.
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.
@SimonSchick
I don't know if that is possible.
Do you know?
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 don't think so given the return type is this
.
🔔 @SimonSchick - Thanks for your review of this PR! Can you please look at the new code and update your review status if appropriate? |
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 included all HTTP methods, changing the type's name.
Also brought the definitions up to trouter@3.0.0
which was released over the weekend.
PS – I know everything here is automated, but if it helps fast-track things, I'm the library author 👍 |
Co-Authored-By: lukeed <luke.edwards05@gmail.com>
Co-Authored-By: lukeed <luke.edwards05@gmail.com>
types/trouter/index.d.ts
Outdated
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.3 | ||
|
||
export interface FindResult<T> { |
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 want to put FindResult
, HTTPMethod
, and FindReturn
into a namespace Trouter
that merges with the class.
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've no idea what this means, but it was done originally with contention: e83a760#r261887776
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.
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.
Okay, thanks for the explanation 👍 I'll wrap it as before. However, does this mean that users won't be able to import the HTTPMethod
& co?
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'll still be able to. import {HTTPMethod} from "trouter"
will work fine - you'll just need to import Trouter = require("trouter")
for the class. Trouter.HTTPMethod
will also work on the latter.
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.
Great, thanks for your help and patience :)
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.
Sorry about this, I've been reviewing quite a lot of packages the last couple of days and might've mixed up exports in this case.
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.
All good! I was confused to begin with 😉
@stahlstift The Travis CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
- part of 3.0 release
I just published |
Please fill in this template.
npm test
.)npm run lint package-name
(ortsc
if notslint.json
is present).Select one of these and delete the others:
If adding a new definition:
.d.ts
files generated via--declaration
dts-gen --dt
, not by basing it on an existing project.tslint.json
should be present, andtsconfig.json
should havenoImplicitAny
,noImplicitThis
,strictNullChecks
, andstrictFunctionTypes
set totrue
.