microsoft/typescript-go · error · Error
${publishedTypeScriptAliasPackageName} should alias the type
Error message
${publishedTypeScriptAliasPackageName} should alias the typescript package, but found ${packageJson.name}. What it means
getPublishedTypeScriptPackageJson (Herebyfile.mjs, memoized) resolves `@typescript/bundled-typescript` — an npm alias that must redirect to the real `typescript` package — under `_extension/node_modules` or the repo-root `node_modules`, parses its package.json, and first checks `name === "typescript"`. Any other name means the resolved package is not a typescript alias, so every downstream version and platform lookup would be wrong, and it throws.
Source
Thrown at Herebyfile.mjs:2207
hiddenFromTaskList: true,
dependencies: options.forRelease || usePublishedPlatformPackagesForVsix ? undefined : [buildNativePreviewPackages, cleanSignTempDirectory],
run: runPackVsixExtensions,
});
/** @type {Map<string, Promise<string>>} */
const publishedPlatformPackageLibDirs = new Map();
const getPublishedTypeScriptPackageJson = memoize(() => {
const candidates = [
path.join(extensionDir, "node_modules", publishedTypeScriptAliasPackageName, "package.json"),
path.join(__dirname, "node_modules", publishedTypeScriptAliasPackageName, "package.json"),
];
for (const candidate of candidates) {
if (fs.existsSync(candidate)) {
const packageJson = JSON.parse(fs.readFileSync(candidate, "utf8"));
if (packageJson.name !== "typescript") {
throw new Error(`${publishedTypeScriptAliasPackageName} should alias the typescript package, but found ${packageJson.name}.`);
}
if (!packageJson.version || typeof packageJson.version !== "string") {
throw new Error(`${publishedTypeScriptAliasPackageName} package.json did not contain a version.`);
}
if (!packageJson.optionalDependencies || typeof packageJson.optionalDependencies !== "object") {
throw new Error(`${publishedTypeScriptAliasPackageName} package.json did not contain platform optionalDependencies.`);
}
return packageJson;
}
}
throw new Error(`Could not find ${publishedTypeScriptAliasPackageName}; run npm install first.`);
});
function getPublishedTypeScriptVersion() {
const version = getPublishedTypeScriptPackageJson().version;
const expectedVersion = getVersion();
if (usePublishedPlatformPackagesForVsix && version !== expectedVersion) {
View on GitHub (pinned to 1bcfa18d79)
Solutions
- Inspect the `name` field in `_extension/node_modules/@typescript/bundled-typescript/package.json` and in root `node_modules/@typescript/bundled-typescript/package.json` to find which candidate is wrong
- Delete the offending `@typescript/bundled-typescript` directory (or both node_modules trees) and re-run `npm install` at the repo root
- Check the package-lock entry for `@typescript/bundled-typescript` still resolves to a package named `typescript`, and that no .npmrc override redirects the registry
Defensive patterns
Strategy: validation
Validate before calling
// Validate the alias package.json before starting the VSIX pipeline
function validateAliasName(p) {
const pj = JSON.parse(fs.readFileSync(p, "utf8"));
if (pj.name !== "typescript") {
throw new Error(`${p} resolved to "${pj.name}", expected "typescript" — reinstall`);
}
return pj;
} Prevention
- Run `npm install` at the repo root after every branch switch or version bump
- Never hand-edit or partially copy directories under node_modules
- Keep @typescript/bundled-typescript pinned via the committed package-lock.json
When it happens
Trigger: A VSIX build that uses published platform packages (usePublishedPlatformPackagesForVsix) while the installed `@typescript/bundled-typescript` directory contains a package whose package.json `name` is not "typescript" — a stale fork, a renamed package, a manually vendored directory, or a bad alias resolution.
Common situations: A corrupted or partially-written node_modules entry from an interrupted npm install; someone replaced the alias with a real package under that scope; a lockfile or .npmrc change pointing the alias at a fork.
Related errors
- ${publishedTypeScriptAliasPackageName} package.json did not
- Found external imports in .d.ts files:\n${importErrors.map(e
- ${publishedTypeScriptAliasPackageName} package.json did not
- Could not find ${publishedTypeScriptAliasPackageName}; run n
- ${publishedTypeScriptAliasPackageName} does not depend on ${
AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16).
Data as JSON: /api/errors/37f72783b31f2b15.
Report an issue: GitHub.