Skip to content

Commit 66c603f

Browse files
robhoganmeta-codesync[bot]
authored andcommitted
Flow types for yargs: Rename ModuleObject -> CommandModule for TS consistency (#55471)
Summary: Pull Request resolved: #55471 Pragmatic rename of this type representing a JS module that exports a Yargs command definition, which we expose to module boundaries in various places. By naming it the same as `types/yargs` does, we don't need to give it any special treatment when translating Flow to TS. See eg: https://app.unpkg.com/types/yargs@17.0.35/files/index.d.ts#L205 Changelog: [Internal] Reviewed By: vzaidman Differential Revision: D92613927 fbshipit-source-id: 8997811233807381a128afb75084f01338d43003
1 parent 1ff0715 commit 66c603f

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

flow-typed/npm/yargs_v17.x.x.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ declare module 'yargs' {
3939
...
4040
}>;
4141

42-
declare type CommonModuleObject = {|
42+
declare type CommonCommandModule = {|
4343
command?: string | Array<string>,
4444
aliases?: Array<string> | string,
4545
builder?:
@@ -48,25 +48,25 @@ declare module 'yargs' {
4848
handler?: ((argv: Argv) => void) | ((argv: Argv) => Promise<void>),
4949
|};
5050

51-
declare type ModuleObjectDesc = {|
52-
...CommonModuleObject,
51+
declare type CommandModuleDesc = {|
52+
...CommonCommandModule,
5353
desc?: string | false,
5454
|};
5555

56-
declare type ModuleObjectDescribe = {|
57-
...CommonModuleObject,
56+
declare type CommandModuleDescribe = {|
57+
...CommonCommandModule,
5858
describe?: string | false,
5959
|};
6060

61-
declare type ModuleObjectDescription = {|
62-
...CommonModuleObject,
61+
declare type CommandModuleDescription = {|
62+
...CommonCommandModule,
6363
description?: string | false,
6464
|};
6565

66-
declare type ModuleObject =
67-
| ModuleObjectDesc
68-
| ModuleObjectDescribe
69-
| ModuleObjectDescription;
66+
declare type CommandModule =
67+
| CommandModuleDesc
68+
| CommandModuleDescribe
69+
| CommandModuleDescription;
7070

7171
declare type MiddleWareCallback = (
7272
argv: Argv,
@@ -101,9 +101,9 @@ declare module 'yargs' {
101101
command(
102102
cmd: string | Array<string>,
103103
desc: string | false,
104-
module: ModuleObject,
104+
module: CommandModule,
105105
): this;
106-
command(module: ModuleObject): this;
106+
command(module: CommandModule): this;
107107

108108
commands(
109109
cmd: string | Array<string>,
@@ -116,9 +116,9 @@ declare module 'yargs' {
116116
commands(
117117
cmd: string | Array<string>,
118118
desc: string | false,
119-
module: ModuleObject,
119+
module: CommandModule,
120120
): this;
121-
commands(module: ModuleObject): this;
121+
commands(module: CommandModule): this;
122122

123123
commandDir(
124124
directory: string,
@@ -337,8 +337,8 @@ declare module 'yargs' {
337337
usage(
338338
message: string,
339339
desc?: string,
340-
builder: CommonModuleObject['builder'],
341-
handler: CommonModuleObject['handler'],
340+
builder: CommonCommandModule['builder'],
341+
handler: CommonCommandModule['handler'],
342342
): this;
343343

344344
version(): this;

0 commit comments

Comments
 (0)