From 6a0d0d3a7329e4803f414e88875c3fae7c9ff53f Mon Sep 17 00:00:00 2001 From: Sam Zhou Date: Fri, 20 Nov 2026 13:20:21 -0800 Subject: [PATCH] Type `process.env` and `fs.rm` options with `undefined`, as `@types/node` does Summary: X-link: https://github.com/react/metro/pull/2261 The Node library definitions typed `process.env` values as `string | void`, and the optional `RmOptions` fields as `T | void`. `types/node` uses `undefined` in both places: ``` env: {[key: string]: string | undefined, ...}; force?: boolean | undefined, ``` Library definitions accept `undefined` without any `.flowconfig` option, and Flow treats it the same as `void`, so this changes nothing for code that checks against these definitions today. It matters for projects that give `void` TypeScript's meaning, where `undefined` is the type of a missing value and `void` is not. Metro's copy of these definitions gets the same change, so the two stay identical. Changelog: [Internal] Differential Revision: D133561233 --- flow-typed/environment/node.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/flow-typed/environment/node.js b/flow-typed/environment/node.js index b82b7dfb380..d5de8bbc444 100644 --- a/flow-typed/environment/node.js +++ b/flow-typed/environment/node.js @@ -1674,7 +1674,7 @@ declare module 'fs' { * When `true`, exceptions will be ignored if `path` does not exist. * @default false */ - force?: boolean | void, + force?: boolean | undefined, /** * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or * `EPERM` error is encountered, Node.js will retry the operation with a linear @@ -1683,19 +1683,19 @@ declare module 'fs' { * `true`. * @default 0 */ - maxRetries?: number | void, + maxRetries?: number | undefined, /** * If `true`, perform a recursive directory removal. In * recursive mode, operations are retried on failure. * @default false */ - recursive?: boolean | void, + recursive?: boolean | undefined, /** * The amount of time in milliseconds to wait between retries. * This option is ignored if the `recursive` option is not `true`. * @default 100 */ - retryDelay?: number | void, + retryDelay?: number | undefined, }; /** @@ -5624,7 +5624,7 @@ declare class Process extends events$EventEmitter { cwd(): string; disconnect?: () => void; domain?: domain$Domain; - env: {[key: string]: string | void, ...}; + env: {[key: string]: string | undefined, ...}; emitWarning(warning: string | Error): void; emitWarning( warning: string,