From 66c603f57ea82a42aaeb11a00f931ad104b335d6 Mon Sep 17 00:00:00 2001 From: Rob Hogan Date: Mon, 9 Feb 2026 08:30:34 -0800 Subject: [PATCH] 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 --- flow-typed/npm/yargs_v17.x.x.js | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/flow-typed/npm/yargs_v17.x.x.js b/flow-typed/npm/yargs_v17.x.x.js index 6d0dcf8f6ae..cf04fbf5f37 100644 --- a/flow-typed/npm/yargs_v17.x.x.js +++ b/flow-typed/npm/yargs_v17.x.x.js @@ -39,7 +39,7 @@ declare module 'yargs' { ... }>; - declare type CommonModuleObject = {| + declare type CommonCommandModule = {| command?: string | Array, aliases?: Array | string, builder?: @@ -48,25 +48,25 @@ declare module 'yargs' { handler?: ((argv: Argv) => void) | ((argv: Argv) => Promise), |}; - 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, desc: string | false, - module: ModuleObject, + module: CommandModule, ): this; - command(module: ModuleObject): this; + command(module: CommandModule): this; commands( cmd: string | Array, @@ -116,9 +116,9 @@ declare module 'yargs' { commands( cmd: string | Array, 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;