Flow types for yargs: Rename ModuleObject -> CommandModule for TS consistency (#55471)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
Rob Hogan authored and meta-codesync[bot] committed 2026-02-09 08:30:34 -08:00
1 parent 1ff071544e
commit 66c603f57e
1 file changed
+17 -17
+17 -17
View File
@@ -39,7 +39,7 @@ declare module 'yargs' {
...
}>;
declare type CommonModuleObject = {|
declare type CommonCommandModule = {|
command?: string | Array<string>,
aliases?: Array<string> | string,
builder?:
@@ -48,25 +48,25 @@ declare module 'yargs' {
handler?: ((argv: Argv) => void) | ((argv: Argv) => Promise<void>),
|};
declare type ModuleObjectDesc = {|
...CommonModuleObject,
declare type CommandModuleDesc = {|
...CommonCommandModule,
desc?: string | false,
|};
declare type ModuleObjectDescribe = {|
...CommonModuleObject,
declare type CommandModuleDescribe = {|
...CommonCommandModule,
describe?: string | false,
|};
declare type ModuleObjectDescription = {|
...CommonModuleObject,
declare type CommandModuleDescription = {|
...CommonCommandModule,
description?: string | false,
|};
declare type ModuleObject =
| ModuleObjectDesc
| ModuleObjectDescribe
| ModuleObjectDescription;
declare type CommandModule =
| CommandModuleDesc
| CommandModuleDescribe
| CommandModuleDescription;
declare type MiddleWareCallback = (
argv: Argv,
@@ -101,9 +101,9 @@ declare module 'yargs' {
command(
cmd: string | Array<string>,
desc: string | false,
module: ModuleObject,
module: CommandModule,
): this;
command(module: ModuleObject): this;
command(module: CommandModule): this;
commands(
cmd: string | Array<string>,
@@ -116,9 +116,9 @@ declare module 'yargs' {
commands(
cmd: string | Array<string>,
desc: string | false,
module: ModuleObject,
module: CommandModule,
): this;
commands(module: ModuleObject): this;
commands(module: CommandModule): this;
commandDir(
directory: string,
@@ -337,8 +337,8 @@ declare module 'yargs' {
usage(
message: string,
desc?: string,
builder: CommonModuleObject['builder'],
handler: CommonModuleObject['handler'],
builder: CommonCommandModule['builder'],
handler: CommonCommandModule['handler'],
): this;
version(): this;