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
update(yargs): Types for arg in MiddlewareFunction #52265
Conversation
Hey @seivan, 😒 Your PR doesn't modify any tests, so it's hard to know what's being fixed, and your changes might regress in the future. Please consider adding tests to cover the change you're making. Including tests allows this PR to be merged by yourself and the owners of this module. This can potentially save days of time for you! |
@seivan Thank you for submitting this PR! I see this is your first time submitting to DefinitelyTyped 👋 — I'm the local bot who will help you through the process of getting things through. This is a live comment which I will keep updated. 1 package in this PRCode ReviewsBecause this is a widely-used package, a DT maintainer will need to review it before it can be merged. Status
All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes. InactiveThis PR has been inactive for 31 days — closed because it wasn't merged for a long time! Diagnostic Information: What the bot saw about this PR{
"type": "info",
"now": "-",
"pr_number": 52265,
"author": "seivan",
"headCommitOid": "e563588e680f5658812b2cc39a2c2c2be2dc0509",
"lastPushDate": "2021-04-08T15:37:00.000Z",
"lastActivityDate": "2021-04-14T18:04:18.000Z",
"mergeOfferDate": "2021-04-14T18:04:58.000Z",
"hasMergeConflict": false,
"isFirstContribution": true,
"tooManyFiles": false,
"popularityLevel": "Critical",
"pkgInfo": [
{
"name": "yargs",
"kind": "edit",
"files": [
{
"path": "types/yargs/index.d.ts",
"kind": "definition"
}
],
"owners": [
"poelstra",
"mizunashi-mana",
"pushplay",
"JimiC",
"steffenvv",
"forivall",
"ExE-Boss",
"Aankhen"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Critical"
}
],
"reviews": [
{
"type": "approved",
"reviewer": "rbuckton",
"date": "2021-04-14T18:04:18.000Z",
"isMaintainer": true
}
],
"ciResult": "pass"
} |
🔔 @poelstra @mizunashi-mana @pushplay @JimiC @steffenvv @forivall @ExE-Boss @Aankhen — please review this PR in the next few days. Be sure to explicitly select |
@seivan The CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
Instead of existing `T[]`. New conventions?
👋 Hi there! I’ve run some quick measurements against master and your PR. These metrics should help the humans reviewing this PR gauge whether it might negatively affect compile times or editor responsiveness for users who install these typings. Let’s review the numbers, shall we? Comparison details 📊
It looks like nothing changed too much. I won’t post performance data again unless it gets worse. |
@seivan Everything looks good here. Great job! I am ready to merge this PR (at e563588) on your behalf. If you'd like that to happen, please post a comment saying:
and I'll merge this PR almost instantly. Thanks for helping out! ❤️ (@poelstra, @mizunashi-mana, @pushplay, @JimiC, @steffenvv, @forivall, @ExE-Boss, @Aankhen: you can do this too.) |
@@ -835,7 +835,7 @@ declare namespace yargs { | |||
type SyncCompletionFunction = (current: string, argv: any) => string[]; | |||
type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray<string>) => void) => void; | |||
type PromiseCompletionFunction = (current: string, argv: any) => Promise<string[]>; | |||
type MiddlewareFunction<T = {}> = (args: Arguments<T>) => void; | |||
type MiddlewareFunction<U> = (args: Arguments<U>) => void; |
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.
this should still have a default type for U
Re-ping @seivan / @poelstra, @mizunashi-mana, @pushplay, @JimiC, @steffenvv, @forivall, @ExE-Boss, @Aankhen: This PR has been ready to merge for over a week, and I haven't seen any requests to merge it. I will close it on May 14th (in three weeks) if this doesn't happen. (If there's no reason to avoid merging it, please do so. Otherwise, if it shouldn't be merged or if it needs more time, please close it or turn it into a draft.) |
After a month, no one has requested merging the PR 😞. I'm going to assume that the change is not wanted after all, and will therefore close it. |
Middlewares in commands do not passed typed arguments.
This will make sure that whatever types passed to
handler
also gets intoMiddlewareFunction
Better types would have
handler
get a combination of types from returned values ofMiddlewareFunction
andbuilder
So a
middleware
can modify content ofargs
before being passed tohandler
, some other time I guess.The CI is failing with
But I haven't introduced
T[]
they were already there, is it ok if I change them toArray<T>
?I avoided changing existing conventions.
npm test <package to test>
.Select one of these and delete the others:
If changing an existing definition: