From 7b94b51269cc687fa9a366852d66c320f172e6fd Mon Sep 17 00:00:00 2001 From: Affaan Mustafa Date: Fri, 13 Feb 2026 01:24:34 -0800 Subject: [PATCH] fix: add missing ReplaceInFileOptions to utils.d.ts type declaration The replaceInFile function in utils.js accepts an optional `options` parameter with `{ all?: boolean }` for replacing all occurrences, but the .d.ts type declaration was missing this parameter entirely. --- scripts/lib/utils.d.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/lib/utils.d.ts b/scripts/lib/utils.d.ts index f668ef5a..7d3cadff 100644 --- a/scripts/lib/utils.d.ts +++ b/scripts/lib/utils.d.ts @@ -93,11 +93,19 @@ export function writeFile(filePath: string, content: string): void; /** Append to a text file, creating parent directories if needed */ export function appendFile(filePath: string, content: string): void; +export interface ReplaceInFileOptions { + /** + * When true and search is a string, replaces ALL occurrences (uses String.replaceAll). + * Ignored for RegExp patterns — use the `g` flag instead. + */ + all?: boolean; +} + /** * Replace text in a file (cross-platform sed alternative). * @returns true if the file was found and updated, false if file not found */ -export function replaceInFile(filePath: string, search: string | RegExp, replace: string): boolean; +export function replaceInFile(filePath: string, search: string | RegExp, replace: string, options?: ReplaceInFileOptions): boolean; /** * Count occurrences of a pattern in a file.