microsoft/TypeScript · error · Error
\n ' ' was not updated while configuring for a prerelease…
Error message
\n '${tsFilePath}' was not updated while configuring for a prerelease publish for '${tag}'.\n Ensure that you have not already run this script; otherwise, erase your changes using 'git checkout -- "${tsFilePath}"'.\n What it means
updateTsFile regex-replaces the `export const version` line in the TS source. configurePrerelease compares the file before and after; if they're identical the replace didn't apply, meaning either the script already ran (source already at the prerelease version) or the version line shape changed and the regex no longer matches.
Solutions
- Revert the source file with `git checkout -- "<tsFilePath>"` and re-run the script.
- Verify the version export still matches `/export const version(?:: string)? = ...`.
- Confirm you haven't already bumped to the prerelease patch.
Example fix
# before (second run of the script fails) $ node scripts/configurePrerelease.mjs dev package.json src/compiler/core.ts # after $ git checkout -- src/compiler/core.ts $ node scripts/configurePrerelease.mjs dev package.json src/compiler/core.ts
Defensive patterns
Strategy: validation
Validate before calling
// Verify the source still matches the pre-prerelease shape before running.
const src = fs.readFileSync(tsFilePath, "utf8");
if (!/export const version(?:: string)? = `\$\{versionMajorMinor\}\.\d(-\w+)?;/.test(src)) {
throw new Error("Source already at prerelease version or regex drifted; run `git checkout -- " + tsFilePath + "` first.");
} Prevention
- Run configurePrerelease exactly once per release; revert the source before re-running.
- Keep the version export line in the canonical shape so the regex stays stable.
When it happens
Trigger: Running configurePrerelease twice without reverting the source; the version regex in the source has been edited and no longer matches.
Common situations: Re-running a release script after a partial earlier run; a merge conflict resolution that altered the version export line.
Related errors
AI-assisted analysis of microsoft/TypeScript@b465fdbfe1 (2026-08-12).
Data as JSON: /api/errors/4837b4a997c61b42.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/configurePrerelease.mjs:54
// Acquire the version from the package.json file and modify it appropriately.
const packageJsonFilePath = normalize(args[1]);
/** @type {PackageJson} */
const packageJsonValue = JSON.parse(readFileSync(packageJsonFilePath).toString());
const { majorMinor, patch } = parsePackageJsonVersion(packageJsonValue.version);
const prereleasePatch = getPrereleasePatch(tag, patch);
// Acquire and modify the source file that exposes the version string.
const tsFilePath = normalize(args[2]);
const tsFileContents = readFileSync(tsFilePath).toString();
const modifiedTsFileContents = updateTsFile(tsFilePath, tsFileContents, majorMinor, patch, prereleasePatch);
// Ensure we are actually changing something - the user probably wants to know that the update failed.
if (tsFileContents === modifiedTsFileContents) {
let err = `\n '${tsFilePath}' was not updated while configuring for a prerelease publish for '${tag}'.\n `;
err += `Ensure that you have not already run this script; otherwise, erase your changes using 'git checkout -- "${tsFilePath}"'.`;
throw new Error(err + "\n");
}
// Finally write the changes to disk.
// Modify the package.json structure
packageJsonValue.version = `${majorMinor}.${prereleasePatch}`;
writeFileSync(packageJsonFilePath, JSON.stringify(packageJsonValue, undefined, 4));
writeFileSync(tsFilePath, modifiedTsFileContents);
}
/* eslint-disable no-restricted-syntax */
/**
* @param {string} tsFilePath
* @param {string} tsFileContents
* @param {string} majorMinor
* @param {string} patch
* @param {string} nightlyPatch
* @returns {string}
*/
View on GitHub (pinned to b465fdbfe1)